Thread: GetFileAttributesEx question...

  1. #1
    Registered User
    Join Date
    Jun 2004

    GetFileAttributesEx question...

    Hi there everyone, I'm trying to learn the fundementals of File System manipulation. Right now I'm trying to get the creation and modification date of a file. How do I use the GetFileAttributesEx function. The function header looks like this:

    BOOL GetFileAttributesEx(
      LPCTSTR lpFileName,                   // file or directory name
      GET_FILEEX_INFO_LEVELS fInfoLevelId,  // attribute class
      LPVOID lpFileInformation              // attribute information 
    This is straight off of the MSDN.

    I understand that LPCTSTR lpFileName is, that one is easy.
    What the heck is GET_FILEEX_INFO_LEVELS fInfoLevelId? I tried to create a simple variable of the GET_FILEEX_INFO_LEVELS type but I couldn't get anything out of it.
    Also, I'm assuming that LPVOID lpFileInformation should just be a pointer to an empty buffer, right?

  2. #2
    Registered User Rare177's Avatar
    Join Date
    May 2004
    the second param is a pointer to a structure, take a look at this
    Good Help Source all round
    Good help for win programmers
    you will probably find something in here
    this thing also helps

    if you have never tried any of the above then maybe you should, they help alot

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    The second parameter is a flag value which specifies which data to return. Currently, only GetFileExInfoStandard is supported which fills in a WIN32_FILE_ATTRIBUTE_DATA structure.
    GetFileAttributesEx(TEXT("myfile.txt"), GetFileExInfoStandard, &wfad);
    printf("Size of myfile.txt is %u\n", wfad.nFileSizeLow);
    You can also use GetFileTime to retrieve the information you are seeking.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM