Results 1 to 6 of 6

Thread: [C++] How to check drive free space?

  1. #1
    Join Date
    May 2007
    Location
    /earth/US/Illinois
    Beans
    1,705
    Distro
    Ubuntu

    [C++] How to check drive free space?

    I am writing an application in C++ using QT. Basically everything uses QT so that it is cross-platform compatible. What I need now is to check the drive space on ANY platform. Is there something built into QT that can do this or do i need to have OS specific sections that are used when the app is compiled on the other OSes? I need to be able to check the drive space on Linux, Windows, and Mac OS. Thanks for any help!
    Dialup or no internet on your Ubuntu box? Have no fear, Keryx is here! Keryx Project
    My blog

  2. #2
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: [C++] How to check drive free space?

    I think you need OS-specific sections. In unix you would use statfs() while in windows you would use GetDiskFreeSpace(). I doubt QT has anything that can do this, and I don't know of any other library that will abstract it for you.

  3. #3
    Join Date
    May 2007
    Location
    /earth/US/Illinois
    Beans
    1,705
    Distro
    Ubuntu

    Re: [C++] How to check drive free space?

    Hey thanks. Thats what I figured i would end up using. I was hoping there would be a library that would be able to abstract it for me so that all that i would need to do was compile it on the other os other than using a language like java.
    Dialup or no internet on your Ubuntu box? Have no fear, Keryx is here! Keryx Project
    My blog

  4. #4
    Join Date
    Apr 2005
    Location
    Hampshire, UK
    Beans
    1,274

    Re: [C++] How to check drive free space?

    Qt doesn't have this, to my knowledge, but I'm fairly sure kdelibs does.

    I doubt QT has anything that can do this
    Actually, this is precisely the kind of thing I would expect to find in Qt, and I'm rather surprised that it isn't there.

    Edit: Well, what do you know - looks like I'm wrong, and kdelibs doesn't have this functionality. I wonder what Dolphin looks like under Windows, then?

    Edit2: Lol - I was right all along:

    http://api.kde.org/4.0-api/kdelibs-a...pp-source.html
    Last edited by GeneralZod; January 4th, 2008 at 11:24 AM.

  5. #5
    Join Date
    Apr 2006
    Beans
    50
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: [C++] How to check drive free space?

    If you can't find anything within QT, have you tried looking at Boost libraries? They are also cross-platform and I'm sure one of them could do what you are looking for.

    I found this on a mailing-list, which may also help.

    Sorry if this doesn't help!

  6. #6
    Join Date
    Feb 2007
    Beans
    13

    Re: [C++] How to check drive free space?

    So, did you ever find anything? I am in a similar situation right now (though I'm not using QT), and it would be very nice if I didn't have to implement this function for each OS.

    I looked at Boost, but I couldn't find anything that returns the free space for a drive.

Bookmarks

Posting Permissions

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