i have tried FileReadString, it works fine. but seems i have porblem with FileReadDouble. i certainly can use StrToDouble to get around it, but just curiosity how to make the FileReadString works. thanks again.
ubzen:
FileReadDouble is used for Binary files. Your file is probably a text file. How was the file created? Was it created using FILE_BIN?
it was created in windows manually.
FileReadDouble is used for Binary files. Your file is probably a text file. How was the file created? Was it created using FILE_BIN?
it was created in windows manually.
Yeah thats why you're having problems. Tested below and it worked.
void start(){ int Handle=FileOpen( WindowExpertName()+".csv", FILE_BIN|FILE_READ|FILE_WRITE ); if(Handle<0) Alert("Problem_Opening_File"); FileSeek(Handle,0,SEEK_SET); FileWriteDouble(Handle,Open[0],8); FileFlush(Handle); FileSeek(Handle,0,SEEK_SET); double Value=FileReadDouble(Handle); Print("the double value is: " + Value); FileClose(Handle); }
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 guys,
i have problem with getting a double value from a local file by using FileReadDouble.
i have stored the "test.csv" in the "MT4_installation_folder\tester\files", the content is simply just "100.11".
i have tried to rename the file to different exension such as "txt" and "dat", but no luck either. there is no issue for the function to find the file, since i dont have any opening file issue/error.
Please help, thanks in advance.