Download MetaTrader 5
To add comments, please log in or register
Publish the program in the Market and sell it to millions of traders!
Michael
490
Michael 2015.12.11 20:23 

Trying to create a csv file.  Now, I know this isn't useful; but in order to figure out a problem; you need to break it down into it's smaller components.  This is the component I'm trying to get work.

The output should be:

1,2,3
1,2,3
1,2,3

 The output I get is:

1,2,31,2,31,2,3

 Here is the code.  Any ideas?

#property strict

#include <Files/FileTxt.mqh>

CFileTxt LogFile;

void OnStart()
  {
   LogFile.Open(StringConcatenate("MyFile",".csv"),FILE_READ|FILE_WRITE);
   LogFile.WriteString(StringConcatenate("1",",","2",",","3"));
   LogFile.WriteString(StringConcatenate("1",",","2",",","3"));
   LogFile.WriteString(StringConcatenate("1",",","2",",","3"));
   LogFile.Close();
   Print("Done!");
  }

 Thanks in advance!

peter.MT4Web
158
peter.MT4Web 2015.12.12 09:38  

Hi!

you have to insert NEW LINE at the end of a line.

LogFile.WriteString(StringConcatenate("1",",","2",",","3","\n"));
Michael
490
Michael 2015.12.14 16:32  
eddie:

Hi!

you have to insert NEW LINE at the end of a line.

Sort of.  I got working.  Here's the code:

#include <Files/FileTxt.mqh>

CFileTxt LogFile;

void OnStart()
  {
   LogFile.Open(StringConcatenate("MyFile",".csv"),FILE_READ|FILE_WRITE);
   LogFile.WriteString(StringConcatenate("1",",","2",",","3","\r\n"));
   LogFile.WriteString(StringConcatenate("1",",","2",",","3","\r\n"));
   LogFile.WriteString(StringConcatenate("1",",","2",",","3","\r\n"));
   LogFile.Close();
   Print("Done!");
  }
/
To add comments, please log in or register