
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
That would be the correct opening method to append an existing file.
Why a 1?
FileWriteString is for writing to Binary file, not CSV
I suggest you review the documentation and samples for File operations.
CSV is what I want and I do not want to append. You are right about "FileReadString(handleA,1)" I don't know where that came from.
After several hours of struggle and testing different example codes I found a solution to satisfy my needs.
string buffer3=ReadFile(rFile);
int count=StringLen(buffer3);
Print("Bytes counted:",count);
WriteFile(wFile,buffer3);
That did the trick. All I wanted in the first plcae was to rename the file (or copy and delete the original) .
Next think I would quite surprisingly like to go back with the process flow of my code. Before this - rfile (that I copied and later is going to delete) needs to be read (buffer3) and use its values as a function call parameters. Now it is a string of 38 (may vary) chars with "," between my parameters. So my first idea was this:
String/buffer is for example, "Brok xy,CHFJPY,30,13,8,8,5,5,3,2,4,2,0"
int index=StringFind(Buffer, ",", 0);
Alert("Index is: ",index); //for checking
string str1=StringSubstr(Buffer,0,index);
Alert("First substr is: ",str1); // "Brok xy"
This is how I get first substring ending ",", but obviously I need more sophisticated method of handling all the Buffer. Maybe picking substrings to Array[13] (if I have 13 parameters in that 38 chars' string). How could I do this without coding each substring separately and with proper handling of End of String. Maybe a for loop and storing parameters to an Array!? Did not find any examples on mql4 community.
Later I would like to use this Array like out_hist(indicator, sArray). Another considerable point is that first two of these parameters are strings and the rest are integers. Is an Array[] possible with mixed types?
Started mql4 one month ago, but learning everyday.
Hope you get the idea. English is not my native language.
Nickel
All I wanted in the first plcae was to rename the file (or copy and delete the original) .
Oh.
Oh.
This is working ok too. Thanks.
Nickel