Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 806 Bytes

closing-files.md

File metadata and controls

20 lines (14 loc) · 806 Bytes
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Closing Files
Closing Files
11/04/2016
MFC, file operations
files [MFC], closing
8415a3a8-3c75-45b0-ac2a-d5385f49bdb3

Closing Files

As usual in I/O operations, once you finish with a file, you must close it.

To close a file

  1. Use the Close member function. This function closes the file-system file and flushes buffers if necessary.

If you allocated the CFile object on the frame (as in the example shown in Opening Files), the object will automatically be closed and then destroyed when it goes out of scope. Note that deleting the CFile object does not delete the physical file in the file system.

See also

Files