View Single Post
  #98 (permalink)  
Old 08-06-2008, 10:10 AM
gorgoroth gorgoroth is offline
Junior Member
 
Join Date: Aug 2008
Posts: 7
gorgoroth is on a distinguished road
gFileRead

Hello,

Looking the source code of mtguru1.dll I'have found that gFileRead() function should not work. Am I Wrong ?

gFileRead() uses a local variable to store the string read from the file. When the function returns, it returns a pointer to that variable, but this pointer can be a valid one because the local variable pbuffer goes out of scope.

So, from a MQL4 EA, an instruction like this should crash :

string buffer = gFileRead( handle, 50 );

and if it works it's strange ...


P.S.: I've posted this in the wrong thread, before. Create your own MetaTrader extension (dll).
Reply With Quote