Hi,
So you should open the file in a combination flag of the common folder :
FileOpen(filename,FILE_WRITE|FILE_CSV|FILE_COMMON,',');
Regards.
Mehrdad Jeddi:
Hi,
So you should open the file in a combination flag of the common folder :
Regards.
Perfect! Thank you.
sd59:
Perfect! Thank you.
You're welcome.
sd59: Please can someone spot the deliberate mistake!?
- Why are you deliberating making mistakes? That's one.
- You are checking for the file in common but creating it in MQL4/files.
-
handle = FileOpen(filename,FILE_WRITE|FILE_CSV,',');
Whether the file exist or not you open it for writing. At that moment, it exists and is zero size. The if exists write else write is unnecessary. -
//if file does exist add data to it
Whether the file exist or not, you open it for writing. At that moment, it exists and is zero size. The FileSeek is unnecessary. - Whether the file exist or not, you open it for writing. At that moment, it exists and is zero size. You are not adding data, you are replacing the file completely.
- Why are you looking at common? Are you really using multiple terminal installations?
int APPEND = FILE_CSV|FILE_WRITE|FILE_READ; string name = … int handle = FileOpen(name, APPEND, '~'); if(handle < 1){ Alert(…); return; } FileSeek(handle, 0, SEEK_END); FileWrite(handle, result); FileClose(handle);
William Roeder:
- Why are you deliberating making mistakes? That's one.
- You are checking for the file in common but creating it in MQL4/files.
-
Whether the file exist or not you open it for writing. At that moment, it exists and is zero size. The if exists write else write is unnecessary.
-
Whether the file exist or not, you open it for writing. At that moment, it exists and is zero size. The FileSeek is unnecessary.
- Whether the file exist or not, you open it for writing. At that moment, it exists and is zero size. You are not adding data, you are replacing the file completely.
- Why are you looking at common? Are you really using multiple terminal installations?
err.. was this meant to be helpful or just a rant?
sd59:
err.. was this meant to be helpful or just a rant?
It was helpful and you should see it as such.
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
Please can someone spot the deliberate mistake!?
I want to write headers to a file in the first instance the subsequently write data. I check to see if file exists first - if it doesn't I write the headers, if it does I just continue to write the data.
When the file has been created it still goes into the first section as though the file does not exist - proven by the print statement.
Here is the code:
thanks