CStdioFile::ReadString

Syntax

virtual char FAR* ReadString( char FAR* lpsz, UINT nMax )
throw( CFileException );

Parameters

lpsz

Specifies a pointer to a user-supplied buffer that will receive a null-terminated text string.

nMax

Specifies the maximum number of characters to read. Should be one less than the size of the lpsz buffer.

Remarks

Reads text data into a buffer, up to a limit of nMax-1 characters, from the file associated with the CStdioFile object. Reading is stopped by a carriage return–linefeed pair. If, in that case, fewer than nMax-1 characters have been read, a newline character is stored in the buffer. A null character ('\0') is appended in either case.

CFile::Read is also available for text-mode input, but it does not terminate on a carriage return–linefeed pair.

Return Value

The buffer containing the text data.

Example

extern CStdioFile f;

char buf[100];

f.ReadString( buf, 100 );