How does GetLastError() work ?

Back to topics list To post a new topic, please log in or register
avatar
250
ffoorr 2015.03.23 10:43
 

Does the last error remain in the  GetLastError() fonction until a new error come

Or does the   GetLastError() fonction is reset ?

avatar
Moderator
3407
GumRai 2015.03.23 12:21 #
 

Does the last error remain in the  GetLastError() fonction until a new error come

Yes 

Or does the   GetLastError() fonction is reset ?

No, unless you reset it with ResetLastError()

Usually , when calling a function, you can check the return value to see if there was an error or not. If there was an error call GetLastError() 

avatar
250
ffoorr 2015.03.23 16:01 #
 
Thank's
avatar
735
honest_knave 2015.03.23 19:17 #
 

From GetLastError():

"After the function call, the contents of _LastError are reset."

avatar
12985
WHRoeder 2015.03.23 19:44 #
 
honest_knave: From GetLastError():

"After the function call, the contents of _LastError are reset."

  1. And that used to be true before Build 600.
  2. Then the documentation said ResetLastError - MQL4 Documentation (29 Jul 2014)
    Note
    It should be noted that the GetLastError() function doesn't zero the _LastError variable. Usually the ResetLastError() function is called before calling a function, after which an error appearance is checked.
  3. And now it says
    Note
    The GetLastError() function  zero the _LastError variable.

Back to topics list  

To add comments, please log in or register