ReadTextLine method
Prototype
ReadTextLine Proto hHandle:HANDLE, lpszBuffer:LPSTR
Syntax
Invoke ReadTextLine, hHandle, lpszBuffer
Function
Reads a line of text from an open file.
Parameters
hHandle
Open handle to a text file (returned by the OpenTextFile method).
lpszFileName
Pointer to the effective address of a buffer to receive the text line. It can be NULL for getting the line length (in bytes).
Return values
If the file could not be read, Eax returns -1.
If lpszBuffer is the effective address of a buffer, Eax returns TRUE if the line has been read, or FALSE if the End Of File (EOF) has been reached.
If lpszBuffer is NULL, Eax returns the lenght of the line (in bytes) including the null-terminating character, or FALSE if the End Of File (EOF) has been reached.
REMARKS: Characters <CR>
and
<LF>
(Carriage
Return
and Line
Feed)
determine the
end of a line. This method reads characters until it finds any of the
following character
combinations:
<CR> + <LF>
<LF> + <CR>
<CR> not followed by <LF>
<LF> not followed by <CR>
The <CR>
and/or <LF>
characters specify the end of a
line, but they are not placed in the buffer
pointed by lpszBuffer.
REMARKS:
The ReadTextLine
method reads a Unicode text line if the application is running as
Unicode,
or an ANSI text line if not (see the IsAppUnicode
method). You can call
ReadTextLineA
to read ANSI text lines
in Unicode applications, or ReadTextLineW
to read Unicode text lines in ANSI applications.
When reading Unicode
files,
remember that the two first bytes in the file (a word) are not a
Unicode character,
but a code identifying the type of Unicode format (0FFFEH
= little endian,
0FEFFH = big endian).
IMPORTANT:
You must ensure the buffer pointed by
lpszBuffer
is large enough to receive the line to be read. Call this method with lpszBuffer
set to NULL
if you want to know how many bytes are needed to contain
the next line to be read.