Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 2.61 KB

files-in-mfc.md

File metadata and controls

50 lines (31 loc) · 2.61 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Files in MFC
Files in MFC
11/04/2016
serialization [MFC], MFC files
I/O [MFC], MFC classes
files [MFC], MFC
files [MFC], serialization
binary access, binary file operations in MFC
file I/O classes [MFC]
I/O [MFC]
persistence [MFC]
MFC, file operations
files [MFC], manipulating
binary access [MFC]
ae25e2c5-2859-4679-ab97-438824e93ce1

Files in MFC

In the Microsoft Foundation Class Library (MFC), class CFile handles normal file I/O operations. This family of articles explains how to open and close files as well as read and write data to those files. It also discusses file status operations. For a description of how to use the object-based serialization features of MFC as an alternative way of reading and writing data in files, see the article Serialization.

Note

When you use MFC CDocument objects, the framework does much of the serialization work for you. In particular, the framework creates and uses the CFile object. You only have to write code in your override of the Serialize member function of class CDocument.

The CFile class provides an interface for general-purpose binary file operations. The CStdioFile and CMemFile classes derived from CFile and the CSharedFile class derived from CMemFile supply more specialized file services.

For more information about alternatives to MFC file handling, see File Handling in the Run-Time Library Reference.

For information about derived CFile classes, see the MFC hierarchy chart.

What do you want to do

Use CFile

Use MFC Serialization (Object Persistence)

See also

Concepts
General MFC Topics
CArchive Class
CObject Class