Download MetaTrader 5

CSV File cannot be opened in notepad

To add comments, please log in or register
Frédéric LEBRE
375
Frédéric LEBRE  

Hi,

I would like to save in common folder 2 variables in order to use them in another EA.

here is my code :

 

if ((hautt!=haut) || (bast!=bas))

           { numfichier=FileOpen("points.csv",FILE_CSV|FILEWRITE|FILE_COMMON,';');

             FileWrite(numfichier,haut,bas);

             FileClose(numfichier);

             hautt=haut;bast=bas;}

 

When I want to open it with notepad to see if everything is ok, I have this message : attached file 

What's wrong ?

Regards, 

honest_knave
Moderator
2326
honest_knave  
Have a read here, specifically about shared access. 
File Opening Flags - Input/Output Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
File Opening Flags - Input/Output Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
File Opening Flags - Input/Output Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
Frédéric LEBRE
375
Frédéric LEBRE  
I thought that using FileClose could be enough to open the file after, with notepad.
honest_knave
Moderator
2326
honest_knave  
Frédéric LEBRE:
I thought that using FileClose could be enough to open the file after, with notepad.
Do you have the same problem with (all the) terminals closed?
Frédéric LEBRE
375
Frédéric LEBRE  

No problem with terminal closed. So what is the use of CloseFile ?

honest_knave
Moderator
2326
honest_knave  
Frédéric LEBRE:

No problem with terminal closed. So what is the use of CloseFile ?

Is that code ending up in a loop? How are you calling it? 
Keith Watford
Moderator
10652
Keith Watford  
Frédéric LEBRE:

No problem with terminal closed. So what is the use of CloseFile ?

Maybe the code is opening and closing the file so rapidly that when you try to open it with Notepad  it always seems to be open.

Have a read of what Honest Knave mentioned re shared access.
To add comments, please log in or register