Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to check free space on memory card

From Wiki
Jump to: navigation, search

Article Metadata
Tested with
Devices(s): N78
Platform(s): S60 3rd,3rd FP1, 3rd Fp2
Platform Security
Signing Required: Self Signed
Keywords: keywords=TDriveInfo,TDriveInfo::Drive(),TDriveInfo::Volume()
Created: lming (01 Nov 2008)
Last edited: hamishwillee (22 Nov 2011)

This snippet shows how the application can check whether there is enough free space on a memory card before attempting to save a file.

Source file

//necessary library
LIBRARY efsrv.lib
//necessary header file
#include <f32file.h>
RFs fileSession;
TVolumeInfo volumeInfo;
//open RFs session
//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
//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: []
if(driveInfo.iType == EMediaNANDFlash)
//recode its free space in bytes
freeKBytes = volumeInfo.iFree/1024;
//close RFs session


The freeSpace variable the free memory space in bytes, on the memory card.

Internal Links:

This page was last modified on 22 November 2011, at 06:45.
34 page views in the last 30 days.