FileWrite

Writes data to a file.

Syntax:

FileWrite (filehandle, output-data)

Parameters:

(i) filehandle same integer that was returned by FileOpen.

(s) output-data data to write to file.

Returns:

(i) always 0.

 

Note: This function will append a CR-LF line terminator to the end of each line written to the file, or as directed by IntControl 53.

If the file is opened in "APPEND" mode, subsequent calls to FileWrite always write the data in the format of the existing text in the file.

If you open the file in "WRITE" mode, then FileWrite will write the text lines according to the unicode parameter:

Mode

Unicode

Text in file

FileWrite output format

"APPEND"

ignored

ANSI

ANSI

"APPEND"

ignored

Unicode

Unicode

"WRITE"

@FALSE(default)

ignored

ANSI

"WRITE"

@TRUE

ignored

Unicode

 

Windows Vista/2008 and newer: This function may require an Administrator level account if dealing with files located in a protected directories: 'Program Files' and 'Windows'.

Example:


handle = FileOpen("stuff.txt", "WRITE")
FileWrite(handle, "Gobbledygook")
FileClose(handle)
Message("FileWrite","File Written.")
See Also:

FileClose, FileOpen, FilePut, FileRead, IntControl 53