您的位置:首页 > 其它

How to check free space on memory card

2011-08-20 03:30 337 查看
LOCAL_C void Main1L()
{
RFs fileSession;
TVolumeInfo volumeInfo;

//open RFs session
fileSession.Connect();

//freeSpace will store number of free memory card in Bytes
TBuf<64> freeSpace;
TInt64 freeKBytes;
//Contains drive information.
TDriveInfo driveInfo;
//check all drives from A to Z
for (TInt driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++)
{
//Gets information of this drive
fileSession.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(driveInfo.iType == EMediaHardDisk)
{
//recode its free space in bytes
fileSession.Volume(volumeInfo,driveNumber);
freeKBytes = volumeInfo.iFree/1024/1024/1024;
freeSpace.Num(freeKBytes);
break;
}
}

//close RFs session
fileSession.Close();
console->Write(freeSpace);
}


//necessary header file

#include <f32file.h>

//for test How to check free space on memory card

LIBRARY efsrv.lib
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: