bits and bytes

Jesus Loves You. C, C++, VC++, .net code snippets and articles, based on Nibu’s day to day programming experiences.

Easiest way to get plenty of information about a file!

Posted by Nibu Thomas on October 14, 2007

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

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>