Archive

Posts Tagged ‘CFileStatus’

Easiest way to get plenty of information about a file!

October 14, 2007 Leave a comment

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 )));