- FileRead function
- Filewrite to csv and fileread to array from csv
- Reading csv files: one column files
Hello free
csv output includes by default the ";" delimiter 0x3B after each datum in one write (if creating a csv and writing 10rows x 10cols)
Opening a csv format file in FILE_BIN mode means reading binary data
eg:
below is csv file in your 10x10 format
below that is the binary content. filereadarray will read enough bytes for each double, and repeat for all doubles.
IOW not going to work.
IF you used FileReadNumber() x 10 per row; you get first 10cols of row0.
You could populate your double array in construct of two loops with handle mapped to opened file with FILE_CSV|FILE_READ attribs:
example: for(i=0;i<=9;i++) for(j=0;j<=9;j++) array[i][j]=FileReadNumber(handle); //inner loop picks up one rows worth doubles --> [i][0..9]
If you want to mess with files (especially using mql) you should get yourself an editor or hex viewer/editor (I use PsPad is a good freeware editor with tons of features)
A picture as they say tells all and is then more obvious to see why reading binary not work.
/*
0;1;2;3;4;5;6;7;8;0
1;1;2;3;4;5;6;7;8;1
2;1;2;3;4;5;6;7;8;2
3;1;2;3;4;5;6;7;8;3
4;1;2;3;4;5;6;7;8;4
5;1;2;3;4;5;6;7;8;5
6;1;2;3;4;5;6;7;8;6
7;1;2;3;4;5;6;7;8;7
8;1;2;3;4;5;6;7;8;8
9;1;2;3;4;5;6;7;8;9
*/
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use