WriteFile

Top  Previous  Next

 

WriteFile

 

Syntax

WriteFile([in] FileID, [in] StringToWrite);

 

Description

To write a string from into an opened file. The file must have been opened with OpenFile using access right "w" or "a".

 

Parameters

       FileID

               The file index to write into.

       StringToWrite

               The string to be written.                

 

Return

       1 = success

       0 = failed

       -1 = FSCommands cannot be found

 

Example

 

FSCommand("WriteFile", "0,Testing Data");

 

This will write a string "Testing Data" into a file assigned at file index 0.

 

You can use a special character \n to insert a new line into a string as followed:

 

FSCommand("WriteFile", "0,Testing Line 1\nTestingLine2");

 

This will write a string ...

 

Testing Line 1

Testing Line 2

 

... into a file assigned at index 0.

 

You can use an escape character ~ (tilda) to insert a comma into a string as followed:

 

FSCommand("WriteFile", "0,John~,Michael and Lucy");

 

This will write a string ...

 

John, Michael and Lucy

 

... into a file assigned at index 0