string text = "aaaaaaaaaaaaaaaaaaaa"; int filehandle0l=FileOpen(File_Name1,FILE_TXT|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,text,StringLen(text)); FileClose(filehandle0l); }
I cannot already define string text like you defined. It is generated by some conditions.
Hi friends, the above code give me the result as follows But I need the result as follows Please help me...thanks.
Build your string before writing to the file then?
// build string however you do it for(int i=0;i<5;i++) tx+="a"; int filehandle0l=FileOpen(filename,FILE_TXT|FILE_WRITE|FILE_READ); FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,tx); FileClose(filehandle0l);
Then open the file with FILE_BIN and use FileWriteInteger with CHAR_VALUE flag.
hi do you mean as follows?
if(condition) { int filehandle0l=FileOpen("File_Name1.bin",FILE_BIN|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWriteInteger(filehandle0l,"a",CHAR_VALUE); FileClose(filehandle0l); }
Build your string before writing to the file then?
for() { if(condition) { int filehandle0l=FileOpen(File_Name1,FILE_TXT|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,"l"); FileClose(filehandle0l); } } /////////////////////////////////// if(condition) { int filehandle0l=FileOpen(File_Name1,FILE_TXT|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,"r"); FileClose(filehandle0l); } } /////////////////////////////////////////////// if(condition) { int filehandle0l=FileOpen(File_Name1,FILE_TXT|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,"b"); FileClose(filehandle0l); } } //////////////////////////////////// if(condition) { int filehandle0l=FileOpen(File_Name1,FILE_TXT|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWrite(filehandle0l,"k"); FileClose(filehandle0l); } } }depending on conditions this may give the result as
r l k b k k r lbut i need the result as
rlkbkkrlPls help. thank you.
It's because a new line character \n will be automatically added.
FileWrite
The function is intended for writing of data into a CSV file, delimiter being inserted automatically unless it is equal to 0.
After writing into the file, the line end character "\r\n" will be added.
In your case that is undesirably because it will put every new entry on a new line.
In stead you want to write a function that appends your data to the same line until you manually add a \n new line chr.
hi do you mean as follows?
if so i am getting the result as
if(condition) { int filehandle0l=FileOpen("File_Name1.bin",FILE_BIN|FILE_WRITE|FILE_READ|FILE_SHARE_READ); if(filehandle0l!=INVALID_HANDLE) { FileSeek(filehandle0l,0,SEEK_END); FileWriteInteger(filehandle0l,'a',CHAR_VALUE); FileClose(filehandle0l); }
Please mind double quotes around the letter (a) are changed to single quote. "a" -> 'a'
Please mind double quotes around the letter (a) are changed to single quote. "a" -> 'a'
ohh! sorry friend, my mistake. Yes now it works!!. thank you so much.
Thanks to all.....
ohh! sorry friend, my mistake. Yes now it works!!. thank you so much.
Thanks to all.....
Happy to hear it helped.
You're welcome.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use