Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

File I/O Classes 

These classes provide an interface to traditional disk files, in-memory files, Active streams, and Windows sockets. All of the classes derived from CFile can be used with a CArchive object to perform serialization.

Use the following classes, particularly CArchive and CFile, if you write your own input/output processing. Normally you do not need to derive from these classes. If you use the application framework, the default implementations of the Open and Save commands on the File menu will handle file I/O (using class CArchive), as long as you override your document's Serialize function to supply details about how a document serializes its contents. For more information about the file classes and serialization, see the article Files in MFC and the article Serialization.


Provides a file interface to binary disk files.


Provides a CFile interface to buffered stream disk files, usually in text mode.


Provides a CFile interface to in-memory files.


Provides a CFile interface to shared in-memory files.


Uses the COM IStream interface to provide CFile access to compound files.


Provides a CFile interface to a Windows Socket.

Related Classes


Cooperates with a CFile object to implement persistent storage for objects through serialization (see CObject::Serialize).


An archive exception.


A file-oriented exception.


Provides a standard dialog box for opening or saving a file.


Handles caching HTML output. Functionally similar to CMemFile.


Maintains the most recently used (MRU) file list.

See Also

Community Additions

© 2015 Microsoft