获取S60手机存储卡总大小和可用大小

本文介绍了一个用于Symbian系统的C++函数,该函数通过遍历从A到Z的所有驱动器来查找EMediaNANDFlash或EMediaHardDisk类型的驱动器,并从中获取内存卡的总大小及空闲空间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

TInt64 GetFreeSpaceOfMMC(TInt& TotalSize)
{
        TVolumeInfo volumeInfo;

        //freeSpace will store number of free memory card in Bytes
        TBuf<64> freeSpace;
        TInt64 freeKBytes = 0;
        TotalSize = 0;
        //Contains drive information.
        TDriveInfo driveInfo;

        //check all drives from A to Z
        for (TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++)
        {
                //Gets information of this drive
                CEikonEnv::Static()->FsSession().Drive(driveInfo, driveNumber);

                //if this drive is EMediaNANDFlash,we find drive of Memory card
                // also reported my DiBo Members that on some devices it can be EMediaHardDisk
                // ref: [http://discussion.forum.nokia.com/forum/showthread.php?t=156990]
                if ((driveNumber!=EDriveC && driveInfo.iType == EMediaNANDFlash)
                                || driveInfo.iType == EMediaHardDisk)
                {
                        //recode its free space in bytes
                        CEikonEnv::Static()->FsSession().Volume(volumeInfo, driveNumber);
                        freeKBytes = volumeInfo.iFree / 1024;
                        TotalSize = volumeInfo.iSize/1024;
                        freeSpace.Num(freeKBytes);
                        break;
                }
        }
        return freeKBytes;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值