xsgex: FileIsLineEnding on line 2 keeps returning True. What is the work around this?
| while (!FileIsEnding(fh)) { while (!FileIsLineEnding(fh)) { words[i++] = FileReadString(fh); } } |
Always read until EOF. | while (!FileIsEnding(fh)){ do{ words[i++] = FileReadString(fh); while (!FileIsLineEnding(fh)); // Do something at EOL } //EOF |
If you don't need to do something at end of line, stop checking for it. | while (!FileIsEnding(fh)){ words[i++] = FileReadString(fh); } //EOF |
whroeder1:
| |
Always read until EOF. | |
If you don't need to do something at end of line, stop checking for it. | |
Thanks! The do-while construct is what I needed, and I'm embarrassed that I didn't think of it sooner.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
It appears that FileIsLineEnding does not reset the EOL flag when called. This makes it impossible to use it to iterate over lines of text in the following fashion:
The first line is read (and broken down into words), however the second line can not be read, because FileIsLineEnding on line 2 keeps returning True.
What is the work around this?
MetaTrader Version 4.00 Build 1090