[英]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.