Download MetaTrader 5
To add comments, please log in or register
Learning MQL5? Start with documentation!
filipefr
58
filipefr 2015.01.02 23:42 

I'm using Ubuntu 14 and trying to create a script to write files, but I'm getting the 5004 error, every time I try to open a file.

datetime currtime;

bool newcandle;

string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);

string filename=terminal_data_path+"\\MQL4\\Files\\"+"data.csv"; 

 

filehandle=FileOpen(filename,FILE_WRITE|FILE_CSV);

             if(filehandle<0)

               {

                Print("Failed to open the file by the absolute path ");

                Print("Error code ",GetLastError());

               } else 

               {

                    Print("file opened with sucess");

               } 

 How can I solve this problem on Ubuntu? 

whroeder1
13627
whroeder1 2015.01.03 03:17  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. string filename=terminal_data_path+"\\MQL4\\Files\\"+"data.csv"; 
    Use this. Been ask and answered many times.
filipefr
58
filipefr 2015.01.03 22:17  

Thanks. I had search for the problem, but didn't a similar problem (specifically open file in a linux env).

 I tried your approach, but I'm still getting the 5004 error. Take a look at my code: 

 

 

string filename= "data.csv";

int filehande 

     filehandle=FileOpen(filename,FILE_WRITE|FILE_CSV,";");

             if(filehandle==INVALID_HANDLE)

               {

                   

                Print("Failed to open the file by the absolute path ");

                Print("Error code ",GetLastError());

               } else 

               {

                    Print("file opened with sucess");

               }

     

     

     } 
Carl Schreiber
5954
Carl Schreiber 2015.01.03 22:40  
Have you checked for the Error codes?
/
To add comments, please log in or register