GetFileAttributesEx question...

This is a discussion on GetFileAttributesEx question... within the Windows Programming forums, part of the Platform Specific Boards category; Hi there everyone, I'm trying to learn the fundementals of File System manipulation. Right now I'm trying to get the ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    124

    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:

    Code:
    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
    Posts
    214
    the second param is a pointer to a structure, take a look at this

    http://msdn.microsoft.com/library/de...e_data_str.asp
    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
    Posts
    2,544
    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.
    Code:
    WIN32_FILE_ATTRIBUTE_DATA  wfad;
    
    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 Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 03:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 06:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 01:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21