MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  File functions  FileFlush

 
void FileFlush( int handle)
Flushes all data stored in the file buffer to the disk.
Notes: The FileFlush() function must be called between operations of file reading and writing in the file.
At file closing, the data are flushed to the disk automatically, so there is no need to call the FileFlush() function before calling of the FileClose() function.
Parameters:
handle   -   File handle, returned by FileOpen() functions.
Sample:
  int bars_count=Bars;
  int handle=FileOpen("mydat.csv",FILE_CSV|FILE_WRITE);
  if(handle>0)
    {
     FileWrite(handle, "#","OPEN","CLOSE","HIGH","LOW");
     for(int i=0;i<bars_count;i++)
       FileWrite(handle, i+1,Open[i],Close[i],High[i], Low[i]);
     FileFlush(handle);
     ...
     for(int i=0;i<bars_count;i++)
       FileWrite(handle, i+1,Open[i],Close[i],High[i], Low[i]);
     FileClose(handle);
    }