Information about disk

This is a discussion on Information about disk within the C Programming forums, part of the General Programming Boards category; Originally posted by Salem [B] And what about the first parameter being NULL - what does that mean - the ...

  1. #16
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Salem
    [B]
    And what about the first parameter being NULL - what does that mean - the current disk, the 'windows' disk or what?
    Null defaults it to the current folder's drive

    Originally posted by Salem

    > 20 GB is the capacity
    From MSDN
    The GetDiskFreeSpace function cannot report volume sizes that are greater than 2 GB. To ensure that your application works with large capacity hard drives, use the GetDiskFreeSpaceEx function.
    Hmm....It always worked for me......and has done on the examples I just gave.... (1 drive 37.5GB and the other 8.5GB - both tested fine!)

    Suppose I better keep that in mind next time I need to check disk size....

  2. #17
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    Code:
    INT64 i64FreeBytesToCaller = 0, i64TotalBytes = 0, i64FreeBytes = 0;
    
    if (GetDiskFreeSpaceEx (NULL, (PULARGE_INTEGER)&i64FreeBytesToCaller,
    (PULARGE_INTEGER)&i64TotalBytes,
    (PULARGE_INTEGER)&i64FreeBytes))
    {
        printf ("Free space: %u GB", i64FreeBytes/1024/1024/1024);
        printf ("Capacity: %u GB", i64TotalBytes/1024/1024/1024);
    }
    This code is working now except that instead of a whole drive capacity I only get the partition capacity. Any ideas how to get the whole drive capacity with this function?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  3. #18
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by GaPe
    Code:
    INT64 i64FreeBytesToCaller = 0, i64TotalBytes = 0, i64FreeBytes = 0;
    
    if (GetDiskFreeSpaceEx (NULL, (PULARGE_INTEGER)&i64FreeBytesToCaller,
    (PULARGE_INTEGER)&i64TotalBytes,
    (PULARGE_INTEGER)&i64FreeBytes))
    {
        printf ("Free space: %u GB", i64FreeBytes/1024/1024/1024);
        printf ("Capacity: %u GB", i64TotalBytes/1024/1024/1024);
    }
    This code is working now except that instead of a whole drive capacity I only get the partition capacity. Any ideas how to get the whole drive capacity with this function?
    with that function? no.
    hello, internet!

  4. #19
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    Which function is good for retrieving information of the large capacity drives?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2009, 08:54 PM
  2. hard disk information
    By rehan in forum Windows Programming
    Replies: 12
    Last Post: 08-29-2008, 10:37 PM
  3. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 07:27 PM
  4. Formatting Output
    By Aakash Datt in forum C++ Programming
    Replies: 2
    Last Post: 05-16-2003, 09:20 PM
  5. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-21-2002, 12:35 AM

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