简体   繁体   English

如何在Qt应用程序中获取SD卡的总空间和已用空间?

[英]How to get Total and Used Space of a SD Card in Qt Application?

Hi friends I am working on a Qt application where I need to display the total space and used space of a SD Card which is connected to my PC. 嗨,朋友,我正在Qt应用程序上工作,我需要显示连接到PC的SD卡的总空间和已用空间。 I need to display them in the form of a string. 我需要以字符串形式显示它们。 Eg 7.6 [GB] or 876 [MB] 例如7.6 [GB]或876 [MB]

Is their a Qt API that can help me achieve it? 他们的Qt API可以帮助我实现吗? basically I am looking for an API to whom I can pass the path of the drive and it in-turn gives me the total and used space of the SD Card. 基本上,我正在寻找一个API,我可以将驱动器的路径传递给该API,并且依次提供给我SD卡的总空间和已用空间。

Please help :) 请帮忙 :)

As stated in this question , there's no multiplatform way to do this, so Qt doesn't have api for that. 该问题所述 ,没有多平台方法可以执行此操作,因此Qt对此没有api。
In case you're on windows, you can use GetDiskFreeSpaceEx . 如果您在Windows上,则可以使用GetDiskFreeSpaceEx In your case, to get total used space, you substract free space from the total space. 对于您的情况,要获得总使用空间,请从总空间中减去可用空间。 Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Qt中获取SD卡的文件系统格式? - How to get the file system format of an SD Card in Qt? 如何使用 boost 或 poco 获取(已用/可用/总)磁盘空间? - How to get (used/available/total) disk space with boost or poco? 如何在Qt中检查插入的SD卡是否被写保护? - How to check whether inserted SD Card is write protected or not in Qt? 磁盘空间? (二手/免费/总计)我怎么得到这个?在C ++中 - Disk Space? (used/free/total) how do I get this? in C++ 如何在Windows上使用Qt c ++搜索特定的SD卡并进行读写操作? - How to search a specific SD card and read from\write to it using Qt c++ on Windows? phytec phyBOARD iMX-6 在从闪存而不是 SD 卡运行 qt5 opengles 应用程序时表现不佳(fps 减半) - phytec phyBOARD iMX-6 performed poorly when running qt5 opengles application from flash instead of sd card (fps halved) 如何在Arduino上为SD卡创建动态文件名 - How to create a dynamic filename for an SD card on Arduino 如何在arduino中从SD卡创建变量 - how to create variable from sd card in arduino 如何读取SD卡ID号? - How to read the SD Card ID number? 如何创建 function:使用文件名作为 function 参数从 SD 卡文件中获取单个值 - How to create a function: Get a single value from SD card file using the file name as function parameter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM