Freigeben über


CStdioFile Class

Represents a C run-time stream file as opened by the run-time function fopen.

class CStdioFile : public CFile

Members

Public Constructors

Name

Description

CStdioFile::CStdioFile

Constructs a CStdioFile object from a path or file pointer.

Public Methods

Name

Description

CStdioFile::Open

Overloaded. Open is designed for use with the default CStdioFile constructor (Overrides CFile::Open).

CStdioFile::ReadString

Reads a single line of text.

CStdioFile::Seek

Positions the current file pointer.

CStdioFile::WriteString

Writes a single line of text.

Public Data Members

Name

Description

CStdioFile::m_pStream

Contains a pointer to an open file.

Remarks

Stream files are buffered and can be opened in either text mode (the default) or binary mode.

Text mode provides special processing for carriage return–linefeed pairs. When you write a newline character (0x0A) to a text-mode CStdioFile object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0D, 0x0A) is translated to a single 0x0A byte.

The CFile functions Duplicate, LockRange, and UnlockRange are not supported for CStdioFile.

If you call these functions on a CStdioFile, you will get a CNotSupportedException.

For more information on using CStdioFile, see the articles Files in MFC and File Handling in the Run-Time Library Reference.

Inheritance Hierarchy

CObject

CFile

CStdioFile

Requirements

Header: afx.h

See Also

Reference

CFile Class

Hierarchy Chart

CFile Class

CFile::Duplicate

CFile::LockRange

CFile::UnlockRange

CNotSupportedException Class

Other Resources

How Do I: Use the CFile Class?