ResetLastError

Consente di impostare il valore della variabile predefinita _LastError a zero.

void  ResetLastError();

Valore restituito

Nessun valore restituito.

Nota

Va notato che la funzione GetLastError() non azzera la variabile _LastError. Di solito la funzione ResetLastError() viene chiamata prima di chiamare una funzione, dopo la quale viene controllata l'apparizione dell' errore.

Esempio:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- resettare l'ultimo codice di errore prima di chiamare la funzione,
//--- altrimenti, GetLastError() potrebbe restituire il codice errore precedente
   long lres=SymbolInfoInteger("123456",SYMBOL_DIGITS);
   PrintFormat("lres=%d  error=%d",lres,GetLastError());
   lres=SymbolInfoInteger(_Symbol,SYMBOL_DIGITS);
   PrintFormat("lres=%d  error=%d",lres,GetLastError());
   ResetLastError();
   lres=SymbolInfoInteger(_Symbol,SYMBOL_DIGITS);
   PrintFormat("lres=%d  error=%d",lres,GetLastError());
  }