I would read the file in the common folder in whole and split it into lines:
bool readCsvFile(const string fName, string &allLines[]) { int nL, nI, hdl = FileOpen(fName,FILE_READ|FILE_SHARE_READ|FILE_BIN|FILE_COMMON); // for files in COMMON-folder!! if (hdl == INVALID_HANDLE) { Alert(fName," FileOpen in COMMON FAILED: ",_LastError); FileClose(hdl); return(false); } string allLines[], singLine[], f = FileReadString(hdl,(int)FileSize(hdl)); FileClose(hdl); nL = StringSplit(f,StringGetCharacter("\n",0),allLines); return(nL); //if needed template code to proceed .. while(nL-->0) { nI = StringSplit(allLines[nL],';',singLine); while(nI-->0) { //itm_N = singLine[nI] // fore each element of line nL .... } } return(nL); }
This template-function return an array with all lines (2nd line is allLines[1]).

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
I have just created an EA that can read the first line of a text file, to obtain a value.
Now, I want to use 2 values: the first one in the first line and the second one in the second line.
My question is how I should modify the source code to read only the second line of the text file?
The actual source code to read a unique first line that I am using is the following:
ResetLastError();
int filesignal= FileOpen("excel_pattern_detected.txt",FILE_TXT|FILE_WRITE|FILE_READ);
if (filesignal != INVALID_HANDLE)
{
content = FileReadString(filesignal);
FileClose(filesignal);
}
Thanks.