Writing to file (Question)

 

Question. Why is this code not writing the string to the file?

int handle=FileOpen("my_data2.txt",FILE_WRITE,';');
if(handle<1){
   Print("cannot open file error-",GetLastError());   
   return(0); // same as return(false)
}
 
FileWriteString(handle, "Hello World", 5);  //truncated...I know, but ignore for now
FileClose(handle);
 
Because of this I presume:

2007.08.19 21:49:24 testScript: attempt to write binary data into CSV file


Either open file as a binary
int handle=FileOpen("my_data2.txt",FILE_WRITE | FILE_BIN);

or use FileWrite()

FileWrite(handle, StringSubstr("Hello World", 0, 5));  //truncated...
 

It works! Thanks Irtron.

Reason: