Because FileReadArray() is to use with binary files.
Read the documentation please !
Hi,
Thanks. I was on the wrong filetype.
I worked out the following function:
string fnReadFileValue(string filename, int line=-1, int column=-1) { string str = ""; string sep = ","; ushort u_sep = StringGetCharacter( sep, 0 ); int fp = FileOpen(filename,FILE_READ|FILE_TXT,","); //comma delimiter if( fp != INVALID_HANDLE ) { FileSeek(fp, 0, SEEK_SET ); while( !FileIsEnding(fp)) { str = FileReadString( fp, 0); string values[]; StringSplit(str, u_sep, values ); } FileClose( fp ); } else Print("File open failed, error ",GetLastError()); return str; }
to load the function:
extern string InpDirectoryName="Exports"; // Export Folder extern string Magic_Numbers_file = "Magics.txt"; // File of Magic Nnumbers string Read_MagicNumbers; Read_MagicNumbers = fnReadFileValue(InpDirectoryName+"//"+Magic_Numbers_file, -1, -1 );
... works :-)
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 try to read a file with several MagicNumbers in order to write it to an array. Somehow there is no data in the array.
The file contains this line:
2011,2012,2052,2053,2058,2029,2030,2059,88,123771,123772,123773,123774,123775,123776,123777,123778,123779,123780,123781,123782,123783,123784,123785,123786,2063,2064,2065,2067,3169,3269,3369,115479,1208500,1208501,1208502,2208500,2208501,2208502
The file is stored in the file-folder of the terminal.
May someone give me a hint what is wrong with the code?