Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.36 KB

accessing-file-status.md

File metadata and controls

33 lines (26 loc) · 1.36 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Accessing File Status | Microsoft Docs
11/04/2016
cpp-windows
article
C++
files [MFC], status information
examples [MFC], file status
files [MFC], accessing
file status [MFC]
status of files [MFC]
1b8891d6-eb0f-4037-a837-4928fe595222
10
mikeblome
mblome
ghogen

Accessing File Status

CFile also supports getting file status, including whether the file exists, creation and modification dates and times, logical size, and path.

To get file status

  1. Use the CFile class to get and set information about a file. One useful application is to use the CFile static member function GetStatus to determine if a file exists. GetStatus returns 0 if the specified file does not exist.

Thus, you could use the result of GetStatus to determine whether to use the CFile::modeCreate flag when opening a file, as shown by the following example:

[!code-cppNVC_MFCFiles#3]

For related information, see Serialization.

See Also

Files