Export (0) Print
Expand All

CFile Class

class CFile : public CObject

Remarks

CFile is the base class for Microsoft Foundation file classes. It directly provides unbuffered, binary disk input/output services, and it indirectly supports text files and memory files through its derived classes. CFile works in conjunction with the CArchive class to support serialization of Microsoft Foundation Class objects.

The hierarchical relationship between this class and its derived classes allows your program to operate on all file objects through the polymorphic CFile interface. A memory file, for example, behaves like a disk file.

Use CFile and its derived classes for general-purpose disk I/O. Use ofstream or other Microsoft iostream classes for formatted text sent to a disk file.

Normally, a disk file is opened automatically on CFile construction and closed on destruction. Static member functions permit you to interrogate a file's status without opening the file.

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

Requirements

Header: afx.h

See Also

MFC Sample DRAWCLI | MFC Sample CHKBOOK

Class Members | Base Class | Hierarchy Chart | CStdioFile | CMemFile

Show:
© 2015 Microsoft