If you open a file to FILE_WRITE, and haven't written to it yet, the size is always 0.
Read the FileOpen() document carefully.
Absolutely! But it exists and it has three lines and acc.to the folder a size of 2k.
So how do I get to know wether
1) I have to write the headline (size == 0) or not and
2) just add the next two lines?
Neither FileSize() nor FileSeek() and FileTell() seem to give me that information!
Carl
You didn't read carefully.
If you open a file for writing ONLY it creates a new empty file.
To append an existing file you open it ro read AND write.
You didn't read carefully.
If you open a file for writing ONLY it creates a new empty file.
To append an existing file you open it ro read AND write.
ok I read:"If there is a need to add data to an existing file, it must be opened using combination of FILE_READ | FILE_WRITE."
But as most of the times the explanation are written by the produceres and not clear for users.
What the hell means "If FILE_WRITE does not combine with FILE_READ, .."
When and why WRITE & READ do not combine? ("..zero-lenght file" is of course clear to me!)
And this "If FILE_READ does not combine with FILE_WRITE, the file will be opened only if
it already exists.
If the file does not exist, it can be created using the FILE_WRITE mode."
Now tell me how can I determin within my program when I do have to write a head-line (=> new file size 0) and when don't?
Carl
This is standard stuff, only slightly flavored by MQL.
http://mycplus.com/tutorials/c-programming-tutorials/file-handling/
phy, i know is google etc. but... such mass of sites out there. u have in a way applied the 'phy' filter and so links u show here always relevant and interesting resources.
maybe u would publish such links/bm's... i for one would prob never get any more work done but such interest is there in ur links.
how bout it?
Best
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
writing to files has definitely some room for improvement :(
very unconvenient that the Array() only writes bin-files not to csv.
So to do further research in excel I have to glue everything to one string to write this liine at once to the csv.
But now I would like to exchange all (us-) decimal dot by the (german) decimal comma in that line - no way, correct?
That means I have to adapt every single column with numbers individually to get it in Excel.
Very nasty.
Second problem: a new csv-File should have a headline with the names of the columns.
To determin, wether that file is new I do:
But this is allways 0 :( FileSize is not working on with handles opend to write - correct?
Do I have to open that file reading first to get the size?
If FileSize does not work on FILE_WRITE, probaly FileTell won't work too on Files opend to write?
Does anybody knows a good workin example to write quite a lot data to a csv-File?
Thanks in advance,
Carl