WriteTextLine method


Syntax

Invoke WriteTextLine, hHandle, lpszBuffer

Function

Writes a line of text to an open file.

Parameters

hHandle

Open handle to a text file (returned by OpenTextFile).

lpszFileName

Pointer to the effective address of a buffer containing the text line to write.

Return value

Eax returns TRUE if succesful, or FALSE if not.


REMARKS: This method checks whether the two last characters of the buffer are <CR> and <LF>. If not, they are added to file (but not to buffer). On the other hand, if the last character is a <CR> but not followed by <LF>, the <LF> character is added to file.


REMARKS: The WriteTextLine method expects lpszBuffer to be a Unicode string if the application is running as Unicode, or an ANSI string if not. You can call WriteTextLineA to write ANSI text lines in Unicode applications, or WriteTextLineW to write Unicode text lines in ANSI applications.

When writing Unicode files, remember that the two first bytes (a word) are not a Unicode character, but a code identifying the type of Unicode file (little endian or big endian). Set these two first bytes to 0FFFEH for little endian, or 0FEFFH for big endian. Take into account that the ReadTextLine method reads Unicode files in little endian format.