Partager via


CStdioFile::WriteString

Writes data from a buffer to the file associated with the CStdioFile object.

virtual void WriteString(
   LPCTSTR lpsz 
);

Parameters

  • lpsz
    Specifies a pointer to a buffer containing a null-terminated text string.

Remarks

The terminating null character ('\0') is not written to the file. Any newline character in lpsz is written to the file as a carriage return–linefeed pair.

WriteString throws an exception in response to several conditions, including the disk-full condition.

This is a text-oriented write function available to CStdioFile and its descendents, and to CArchive. CFile::Write is also available, but rather than terminating on a null character, it writes the requested number of bytes to the file.

Example

CStdioFile f(stdout);
TCHAR buf[] = _T("test string");

f.WriteString(buf);

Requirements

Header: afx.h

See Also

Concepts

CStdioFile Class

CStdioFile Members

Hierarchy Chart

CArchive::ReadString

CFile::Write