CFile

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 article Files in MFC in Visual C++ Programmer's Guide and File Handling in the Run-Time Library Reference.

#include <afx.h>

Class MembersBase ClassHierarchy Chart

Samples   MFC Sample DRAWCLIMFC Sample CHKBOOK

See Also   CStdioFile, CMemFile