Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to determine the total space, used space and fileformat of an SD Card In Qt??
Qt 6.11 is out! See what's new in the release blog

How to determine the total space, used space and fileformat of an SD Card In Qt??

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stoned Jesus
    wrote on last edited by
    #1

    I am working on an app where I have to display the drive name, drive format, total space, used space and the write protect state of an SD Card.

    @typedef struct SDVisualInfo{
    QString strDriveName;
    QString strFileSystem;
    QString strTotal;
    QString strUsed;
    QString strProtectStatus;
    }stSDVsInfo;

    stSDVsInfo newData;
    newData.strDriveName = deviceData->m_strPath; // Device data is a class which gives me the path and write protect state of the drive
    if ( deviceData->m_bReadable == true && deviceData->m_bWritable == true )
    {
    newData.strProtectStatus= "Write Protect Disabled";
    }
    else if ( deviceData->m_bReadable == true)
    {
    newData.strProtectStatus= "Write Protect Enabled";
    }

    QList <stSDVsInfo> m_SDInfoList;
    m_SDInfoList.append(newData);@

    This gives me the drivepath, writeprotect state but I am unable to find the total space, used space and filesystem format of the SD card. Is their a way(Qt Class) which can help me get the above mentioned requirements?

    --
    Thanks & Regards,
    Stoned Jesus

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The api's to get these informations are OS specific, you have to write the code yourself. Look at statvfs for *nix and GetDiskFreeSpaceEx for Windows.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        As mentioned in your other topic, you can use Qt classes for that (well, almost-Qt. They are outside Qt5 at the moment, AFAIK): "QtDriveInfo":https://gitorious.org/qdrive and "QtStorageInfo":http://qt.gitorious.org/qt/qtsystems classes.

        Also, "this discussion":http://comments.gmane.org/gmane.comp.lib.qt.devel/10164 on dev ML might be of interest.

        (Z(:^

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved