Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CArchive::ReadString

Call this member function to read text data into a buffer from the file associated with the CArchive object.

BOOL ReadString( 
   CString& rString  
); 
LPTSTR ReadString( 
   LPTSTR lpsz, 
   UINT nMax  
);
rString

A reference to a CString that will contain the resultant string after it is read from the file associated with the CArchive object.

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.

In the version that returns BOOL, TRUE if successful; FALSE otherwise.

In the version that returns an LPTSTR, a pointer to the buffer containing the text data; NULL if end-of-file was reached.

In the version of the member function with the nMax parameter, the buffer will hold up to a limit of nMax - 1 characters. Reading is stopped by a carriage return-linefeed pair. Trailing newline characters are always removed. A null character ('\0') is appended in either case.

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

See the example for CArchive::WriteString.

Header: afx.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.