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 )));
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: