- Your number is double type, not integer.
- If you want to read from txt file use FileReadNumber not FileReadInteger
- Use proper flags on FileOpen - FILE_READ | FILE_TXT should be enough if the file is not opened by another process, otherwise use FILE_SHARE_READ
- Do not call FileOpen twice - no need for it
- Close the file BEFORE return.
- You can add error handling - try yourself :)
double ReadReceived() { int filehandle=FileOpen("modelout.txt",FILE_READ|FILE_TXT); double modelnum=filehandle!=INVALID_HANDLE?FileReadNumber(filehandle):0.0; FileClose(filehandle); return(modelnum); }

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 need to read the first number from a file. The number is formatted in the file like this:
I don't want the program to take anything into account other than the first number (the first 0).
My current code is:
However, it seems to intepret everything as a 1.
Any help would be greatly appreciated. Thanks!