FileReadString not working with MT5 ?

noChangepromise
47
noChangepromise  

hello, folks


my mt5 script is very simple, it read csv like this :

void OnStart()
  {
//---
   string dt ;
   int file_20 = FileOpen("104782531.csv", FILE_READ|FILE_CSV,';');
      if (file_20!=-1)
       Print("Error is",GetLastError());
   Print(StringToInteger(FileReadString(file_20)));
   FileClose(file_20);

  }

it print value 0 .

I don't know why this not working same as mt4.


my csv file only contain 1 line :


275117161;GBPNZD;1;0.03;0;0;;0;1568327929;1.91565;0.64191;-290;-8.71;-297;151368.44;0;-8.92


Alain Verleyen
40767
Alain Verleyen  
   int file_20 = FileOpen("104782531.csv", FILE_READ|FILE_CSV|FILE_ANSI,';');
noChangepromise
47
noChangepromise  
Alain Verleyen:

You're talented, and saved me.

Alain Verleyen
40767
Alain Verleyen  
noChangepromise:

You're talented, and saved me.

I like your edit ;-)
Juvenille Emperor Limited
Moderator
14195
Eleni Anna Branou  
Alain Verleyen:
I like your edit ;-)

I edited it Alain.

Alain Verleyen
40767
Alain Verleyen  
Eleni Anna Branou:

I edited it Alain.

Aahh :-D
Pedro Oliveira
10
Pedro Oliveira  
Hey, guys

I am trying to use this to read a value like 0.2 or 0.3 from a txt file, tried several flag combinations and the only outcome is erasing the number from the text file, could you somehow help??


here is the code:
int filehandle=FileOpen("lastOpenPositionSize.txt", FILE_READ | FILE_WRITE|FILE_TXT |FILE_ANSI);
//ler
  
//escrever
   if(filehandle!=INVALID_HANDLE)
     {
      //FileWrite(filehandle, "0.3");
      //string str=FileReadString(filehandle);
      string str = FileReadString(filehandle);
      Print("Read: "+ str);
      FileClose(filehandle);
      Print("FileOpen OK");
     }

Thank you in advance,

Pedro