Download MetaTrader 5

Problems when reading a txt.file

To add comments, please log in or register
TradeMachine 2011.09.20 08:41 

I have  generated a txt file containing just "Hello World".

When opening the file by using this code I don´t see the expected text "Hello World" but only "squares" inside the Journal Window of the tester. Any idea?



string ReadPatternFile()


string PatternString;

int filehandle=FileOpen("patternfile.txt",FILE_READ|FILE_TXT);



            PatternString = FileReadString(filehandle);

     } else Print("Operation FileOpen failed, error ",GetLastError());


    Print (PatternString);  //Why do I see only squares?

  return PatternString;



Ilyas 2011.09.20 09:37  

what about the codepage?

Your file is ANSI or UNICODE?

TradeMachine 2011.09.21 07:25  
Yes - the codepage was ANSI. After changing to UNICODE I see "Hello World". Thank you very much!
To add comments, please log in or register