How to check free space on memory card

本文介绍了一个使用RFs文件系统会话检查内存卡自由空间的代码示例,包括连接、驱动信息获取和输出自由空间大小。适用于了解如何在特定环境下检查设备的可用存储。

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

 
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值