Qt5.5
Qt Creator 3.5.1
Windows 7
C++
Hello,
I'm trying to get drive information (ie. floppy, sd card, usb memory stick, cd/dvd drive).
This is the output I get at the moment (A is a floppy, C is an HDD, S is an SD card, Z is a CD/DVD drive)
All drives are showing as type 3 (Fixed).
What should I be looking at to get whether the device is an sd card, cd/dvd drive or removable drive, or even how its fornatted?
Thanks in advance for any help.
If this can be done? I would like to know if the inserted drive media is linux - EXT3/4.
Regards
void pisd::getDriveInfo() {
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
if (storage.isValid()) {
driveInfo = storage.rootPath();
driveInfo.append(storage.displayName());
driveInfo.append(" - ");
driveInfo.
append(QString::number(((float)storage.
bytesTotal() / 1024 / 1024 / 1024),
'f' ,
2));
driveInfo.append(" GB");
driveInfo.append(" - ");
driveInfo.append(driveType());
driveData.append(driveInfo);
}
}
qDebug() << driveData;
}
void pisd::getDriveInfo() {
QString driveInfo, drive;
QStringList driveData;
foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
if (storage.isValid()) {
driveInfo = storage.rootPath();
driveInfo.append(storage.displayName());
driveInfo.append(" - ");
driveInfo.append(QString::number(((float)storage.bytesTotal() / 1024 / 1024 / 1024),'f' ,2));
driveInfo.append(" GB");
driveInfo.append(" - ");
driveInfo.append(driveType());
driveData.append(driveInfo);
}
}
qDebug() << driveData;
}
To copy to clipboard, switch view to plain text mode
Output
("A:/TEST - 0.00 GB - 3", "C:/Main - 100.00 GB - 3", ...... , "S:/boot - 0.05 GB - 3", ...... , "Z:/GParted-live - 0.19 GB - 3")
Output, no floppy, no SD card no CD/DVD.
("A:/A:/ - 0.00 GB - 3", "C:/Main - 100.00 GB - 3", ......, "Z:/Z:/ - 0.00 GB - 3")
Output
("A:/TEST - 0.00 GB - 3", "C:/Main - 100.00 GB - 3", ...... , "S:/boot - 0.05 GB - 3", ...... , "Z:/GParted-live - 0.19 GB - 3")
Output, no floppy, no SD card no CD/DVD.
("A:/A:/ - 0.00 GB - 3", "C:/Main - 100.00 GB - 3", ......, "Z:/Z:/ - 0.00 GB - 3")
To copy to clipboard, switch view to plain text mode
Bookmarks