CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 1999
    Posts
    57

    GetDiskSpace Problem !!

    Hi

    GetDiskSpace is giving a stange problem. it returns -ve value if the Disk space is more than 4 GB.
    Is this an already existing bug ?

    Anand

    M.Anand
    Development - Lead ,
    Satyam Infoway Limited,
    Chennai - 600034
    India

  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: GetDiskSpace Problem !!

    from the docs:
    "The GetDiskFreeSpace function returns incorrect values for volumes that are larger than 2 gigabytes"
    use GetDiskFreeSpaceEx


  3. #3
    Join Date
    Apr 1999
    Posts
    57

    Re: GetDiskSpace Problem !!

    Hi
    Thanks but I am using GetDiskFreeSpaceEx only. It is giving strange behaviour
    Anand

    M.Anand
    Development - Lead ,
    Satyam Infoway Limited,
    Chennai - 600034
    India

  4. #4
    Join Date
    May 1999
    Posts
    69

    Re: GetDiskSpace Problem !!

    I haven't got the documentation to hand, but doesn't the GetDiskFreeSpaceEx function use two parameters (as any thing larger than two GB is not going to fit into one signed 4 byte value.


  5. #5
    Join Date
    Apr 1999
    Location
    Delhi, India
    Posts
    32

    Re: GetDiskSpace Problem !!

    You have to use ULARGE_INTEGER to get the 64 bit value :
    ULARGE_INTEGER available, total, free;
    GetDiskFreeSpaceEx ("C:\\", &available, &total, &free);
    //Separate out the 32 bit components :
    DWORD low, high;
    low = available.LowPart;
    high = available.HighPart;


    Rajaraman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured