Please expose sample of code to illustrate this problem
//+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { int fileHandle = FileOpen("test.txt", FILE_CSV|FILE_READ, ';'); int cnt=0; // initializing... //continue since the file is ending while(!FileIsEnding(fileHandle)) { if(IsStopped()) // as usual :) { //a file which has be opened has to be closed some time, right? :D FileClose(fileHandle); return; } int integer = FileReadNumber(fileHandle); Print("read"+integer); // increase run variable cnt++; } FileClose(fileHandle); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I just saw MT4 behaving very strange.
When parsing a CSV-file of integers without an empty line at the end of the file, it keeps looping with 99% CPU.
The file:
the file is read correctly till FileReadNumber() gets to the very last value (94387), there it simply does not wanna read the number and starts making loops.
The work-around I am using is to make use of FileReadString() (which does not cause this loop) and parse the string to an integer. This solution is needed anyways because otherwise empty lines would get parsed as 0.
I mean, maybe an empty line at the end of the file is needed, FileWrite() adds one, too, IIRC. However, it's definitely not comprehensible for me why MT4 would enter a vicious circle when there is no empty line.
Have you experienced sth. similar or do you where I am wrong?