How does GetLastError() work ?

 

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

Or does the   GetLastError() fonction is reset ?

 

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() 

 
Thank's
 

From GetLastError():

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

 
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.
Reason: