Adding additional information to an existing file created by FileWrite()
TheHonestPrussian: Is there a way in which to achieve this?
-
Perhaps you should read the manual. FileSeek does not take a file name.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. -
Append to the file.
Write to File Syntax - MQL4 programming forum #4 (2019)
To add text to a specific row, you might have to read the entire file, find the line, append it and then rewrite the entire file.
Something like this?
string line=""; int lineno=0; string txt=""; int file0=FileOpen("test0.txt",FILE_READ|FILE_TXT); while(!FileIsEnding(file0)){ line=FileReadString(file0); if(lineno==2) line=StringConcatenate(line," extra info"); txt=StringConcatenate(txt,line,"\n"); lineno++; } FileClose(file0); file0=FileOpen("test0.txt",FILE_WRITE|FILE_TXT); FileWrite(file0,txt); FileClose(file0);
Morning all
I have a FileWrite() function which works perfectly, however, I am wanting to add attentional information in new columns appended to the end of an existing spreadsheet, created by the FileWrite() function.
Is there a way in which to achieve this?
All the best,
Pip Pip!