As I said, I read the entire file (file-length) and first split by \n into the line-array and then I split each line into items.
Gooly,
Thanks for the link. And here is where I am struggling with getting the concepts in order.
Will I be able to write to overwrite the same file or it will be a new file ? My requirement is, it needs to be the same file and second thing if I read the contents thru a loop perhaps
for(i=0;i<StringLen(str);i++)
how can I overwrite the file as I am reading the file? Will be appreciated if you can provide me a sample script related to my example
1) Open the file only to read it, follow the advises of my second link. CLOSE it, do something and then write it. Opening a file solely to write empties an existing file completely.
2) Don't read char by char but item by item use the advises of my second link: e.g. handle=FileOpen("test.csv",FILE_READ|FILE_CSV,',');
3) May be if you create the string to write you csv-file don't your "\r" and/or "\n".
Just experiment a bit and learn how one handles files.
You even can google "mt4 read csv integer".
I can promise you all you need has already been published.
1) Open the file only to read it, follow the advises of my second link. CLOSE it, do something and then write it. Opening a file solely to write empties an existing file completely.
2) Don't read char by char but item by item use the advises of my second link: e.g. handle=FileOpen("test.csv",FILE_READ|FILE_CSV,',');
3) May be if you create the string to write you csv-file don't your "\r" and/or "\n".
Just experiment a bit and learn how one handles files.
You even can google "mt4 read csv integer".
I can promise you all you need has already been published.
Gooly - Thank you. Will try and let you know how that goes.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
2,B, Y
3,C,Y
Yes, it will always be the same within that range.
Maybe I wasn't clear earlier, there will be 3 columns and of same size(always) for this scenario.
>>or (I would) read the entire file into your 2-dim. array change some of the data and re-write the entire csv-file.
Can you please give me a sample code for this.
Thanks.
I am using Windows' kernel functions.
But you can look here and here.
As I said, I read the entire file (file-length) and first split by \n into the line-array and then I split each line into items.
I am using Windows' kernel functions.
But you can look here and here.
As I said, I read the entire file (file-length) and first split by \n into the line-array and then I split each line into items.
Gooly,
Thanks for the link. And here is where I am struggling with getting the concepts in order.
Will I be able to write to overwrite the same file or it will be a new file ? My requirement is, it needs to be the same file and second thing if I read the contents thru a loop perhaps
how can I overwrite the file as I am reading the file? Will be appreciated if you can provide me a sample script related to my example
Thanks.
1) Open the file only to read it, follow the advises of my second link. CLOSE it, do something and then write it. Opening a file solely to write empties an existing file completely.
2) Don't read char by char but item by item use the advises of my second link: e.g. handle=FileOpen("test.csv",FILE_READ|FILE_CSV,',');
3) May be if you create the string to write you csv-file don't your "\r" and/or "\n".
Just experiment a bit and learn how one handles files.
You even can google "mt4 read csv integer".
I can promise you all you need has already been published.
1) Open the file only to read it, follow the advises of my second link. CLOSE it, do something and then write it. Opening a file solely to write empties an existing file completely.
2) Don't read char by char but item by item use the advises of my second link: e.g. handle=FileOpen("test.csv",FILE_READ|FILE_CSV,',');
3) May be if you create the string to write you csv-file don't your "\r" and/or "\n".
Just experiment a bit and learn how one handles files.
You even can google "mt4 read csv integer".
I can promise you all you need has already been published.