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 that contains a null-terminated string.

Remarks

The terminating null character (\0) is not written to the file. This method writes newline characters in lpsz to the file as a carriage return/linefeed pair.

If you want to write data that is not null-terminated to a file, use CStdioFile::Write or CFile::Write.

This method throws a CInvalidArgException* if you specify NULL for the lpsz parameter.

This method throws a CFileException* in response to file system errors.

Example

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

f.WriteString(buf);

Requirements

Header: afx.h

See Also

Reference

CStdioFile Class

Hierarchy Chart

CArchive::ReadString

CFile::Write

CStdioFile::ReadString

Other Resources

CStdioFile Members