// ..some initialization // start() {.... //int filesize = FileSize(FileOpen(filename+".csv",FILE_CSV|FILE_READ,';')); //for(int n=0;n<filesize;n++) //{ handle=FileOpen(filename+".csv",FILE_CSV|FILE_READ,';'); if(handle>0) while (!FileIsEnding(handle)) { //FileSeek(handle,n,SEEK_CUR); val = FileReadNumber(handle); } FileClose(handle); else if(handle<1) { Print("error",GetLastError()); return(0); } //}
Thanks a ton!!
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
Im trying to read data from a .csv file.
The file in is the following format:
ex.
124124; 1241.21
12241; 131.1
3113; 1213.0
3123; 31.12
...basically 'n' lines of semicolon delimited values. The left column has all int's while the right has all doubles
I am using the following code to read it:
Im trying to move the pointer along to get each value but what I get is output char by char up to the delimiter.
so using the ex above Id get: 124124, then 24124, then 4124, then, 124, then 24, then 4, then 0 (the delimiter), then 0 again, (the space), then 1241.21... and so on.
How do I read each value from start to end of the file??
Thanks for your help!