Home > MFC > Easiest way to get plenty of information about a file!

Easiest way to get plenty of information about a file!

We all need the easiest right! 😉

Well this is too easy, it’s already done for us by MFC. There is a structure called CFileStatus which holds plenty of information related to a file, for eg: it’s creation, modification, and access time, along with size of file, attribute of a file and absolute file name of the file and all this with just two lines of code and without opening the file. :wow that’s cool:

There is a static method in CFile class called GetStatus this is how we use it…

CFileStatus cfFileStatus;
// Yup that's it
VERIFY( CFile::GetStatus( _T( "C://FileName.someExt", cfFileStatus )));
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment