文件 I/O 类File I/O Classes

这些类为传统磁盘文件、内存中文件、活动流和 Windows 套接字提供接口。These classes provide an interface to traditional disk files, in-memory files, Active streams, and Windows sockets. 从派生的所有类均 CFile 可与对象结合使用 CArchive ,以执行序列化。All of the classes derived from CFile can be used with a CArchive object to perform serialization.

CArchive CFile 如果你编写自己的输入/输出处理,则应使用以下类,特别是。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. 如果使用应用程序框架,则在 "文件" 菜单上的 "打开" 和 "保存" 命令的默认实现将处理使用类) 的文件 i/o (CArchive ,前提是你覆盖文档的 Serialize 函数以提供有关文档如何序列化其内容的详细信息。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. 有关文件类和序列化的详细信息,请参阅 MFC 中的文件 和项目 序列化For more information about the file classes and serialization, see the article Files in MFC and the article Serialization.

CFileCFile
提供二进制磁盘文件的文件接口。Provides a file interface to binary disk files.

CStdioFileCStdioFile
提供 CFile 缓冲流磁盘文件(通常在文本模式下)的接口。Provides a CFile interface to buffered stream disk files, usually in text mode.

CMemFileCMemFile
提供 CFile 内存中文件的接口。Provides a CFile interface to in-memory files.

CSharedFileCSharedFile
提供一个 CFile 用于内存中共享文件的接口。Provides a CFile interface to shared in-memory files.

COleStreamFileCOleStreamFile
使用 COM IStream 接口为 CFile 提供对复合文件的访问权限。Uses the COM IStream interface to provide CFile access to compound files.

CSocketFileCSocketFile
为 Windows 套接字提供 CFile 接口。Provides a CFile interface to a Windows Socket.

CArchiveCArchive
使用对象会 CFile 通过序列化实现对象的持久存储 (参阅 CObject::串行化) 。Cooperates with a CFile object to implement persistent storage for objects through serialization (see CObject::Serialize).

CArchiveExceptionCArchiveException
存档异常。An archive exception.

CFileExceptionCFileException
面向文件的异常。A file-oriented exception.

CFileDialogCFileDialog
提供用于打开或保存文件的标准对话框。Provides a standard dialog box for opening or saving a file.

CRecentFileListCRecentFileList
维护最近使用的 (MRU) 文件列表。Maintains the most recently used (MRU) file list.

请参阅See also

类概述Class Overview