FileWrite (Write File)

The FileWrite function performs an ASCII or binary write to an open data file, referenced by a FileHandle. FileWrite behavior is dependent on the mode and seek point used by FileOpen and the source data type.

Syntax

FileWrite ( FileHandle, Source, Length )

Remarks

This function writes the data in the Source variable to a FileHandle created by FileOpen. This function returns the number of bytes successfully written to the file.

With files opened for writing in ASCII text, every line feed character is replaced with a carriage return. When reading ASCII text files, all carriage return characters (CHR(13)) are discarded and line feed characters (CHR(10)) are converted to end of line.

Parameters

FileHandle (File Handle)

The program reference to the file being read from, written to, or otherwise affected by the function. A FileHandle is created by a FileOpen function and deleted by FileClose. Recommended variable type is Long.

Type: Variable

Source

The constant, variable, or array of variables to be written to file.

Type: Constant, variable, or variable array

Length

The maximum number of characters of Source to be written to the file. Length should be equal to or less than the number of bytes in Source. If Length is set to 0, Source should be a string. Note that in this instance, all bytes up to the first null will be written.

Type: Variable

To write each file using a unique name, refer to FilesManager.