Read from file - missed text

 

Dear all, I need to solve next problem.

I would like to automate some data transfer form mt4 to mt4 in different pc's. So I decide to use SendMail() function.

I take the data what I need and transform it in string (one very long string about 1000 characters), after I send this data to my email, then mail client save me this mail as .txt file in my experts/files/ directory of other MT4.

But when I want to analyze this data from the file I have next issue:

it seems that mt4 with SendMail() divide my string by default (it is really long string) in paragraphs with about 500 characters in one paragraph.

ex. of mail :

238650498574385724985743285093486525238650498574385724985743285093486525 (first paragraph)

743285093486525238650498574385724985747432850934865252386504985743857249 (second paragraph)



>>>And I have problem when I try to read the content of this file (mail that was send by first mt4) i try to use this:

handle=FileOpen("file.txt", FILE_READ);
  if(handle>0)
    {
     str=FileReadString(handle);
     FileClose(handle);
    }

Because in after I go to analyze data from variable "str" and I get in only characters of first paragraph, other are missed.

How can I get other missed text?

thanks for reading :)

 
JohnOne:

Because in after I go to analyze data from variable "str" and I get in only characters of first paragraph, other are missed.

How can I get other missed text?


Your code is reading one line and then stopping. You need to read as many lines as are there before stopping. Use

bool FileIsEnding( int handle) 

in your loop to know when to stop reading. Read one string for one line and concatenate that string with the string-sum to date. You could use

string StringConcatenate( ...) 
 
 
dabbler:

Your code is reading one line and then stopping. You need to read as many lines as are there before stopping. Use

in your loop to know when to stop reading. Read one string for one line and concatenate that string with the string-sum to date. You could use


Thank you for help, dabbler!
Reason: