FileWrite

 

The 'FileWrite' function writes data of the specified buffer to the specified file or the specified print.

 

WORD FileWrite(DWORD handle, string buf, WORD size);

 

Note : Only if a file or a print port is opened, you can write data to the file or the print port. In other words, only if you use the 'FileOpen' function or the 'FileOpenLPT' function, you can use the 'FileWrite' function. Also, after you finish your use of the file or the print port, you must always close the file or the print port. In other words, after you use the 'FileOpen' function or the 'FileOpenLPT' function, you must always use the 'FileClose' function.

 

Parameters

DWORD handle : 'Return Value' of the 'FileOpen' function or the 'FileOpenLPT' function

string buf : data that you want to write to a file or a print port

WORD size : data size (If you input '-1', the data size is calculated automatically - This is supported by using 9.3.7 or higher Version.)

 

Return Value

data size that was written

 

Example1

handle = @FileOpen("C:\\EX.TXT", "a");

if(handle != 0)

{

@FileWrite(handle, "example data", 12);

@FileClose(handle);

}

Description : The first line is to open the file named 'EX.TXT' in C drive. If the file is opened, 'example data' is written to the file. Afterward, the file is closed by the '@FileClose(handle);'.