FileWriteLine Function

Action

Writes a line of text to a file on the host system.

Syntax

FileWriteLine( hFile, sLine)
Variable Description
hFile The handle of the file to write to. HFILE.
sLine The text to write. STRING.

Notes

FileWriteLine writes the specified string to the file identified by hFile. It automatically appends the appropriate character or characters, for example a carriage return/line feed sequence, needed to delimit a line of text on the current platform.

You can get a handle to a file (an HFILE) by calling the FileOpen function with the filemode data type set to either FM_WRITE, FM_UPDATE, or FM_APPEND.

The File functions that control writing to a file do not test your accessibility to a file. This means that you cannot write information to a file that has been opened in read only mode with FileOpen(). The function will successfully return, but no information is actually written to the file. There is no error message that indicates this.

This function is not designed for remote access.

Example

HFILE FileHandle
// Open file, append line, and close
FileHandle = FileOpen("mydata.txt", FM_APPEND)
FileWriteLine(FileHandle, "next line of text")
FileClose(FileHandle)