How to check free space on memory card

 
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

你可能感兴趣的:(How to check free space on memory card)