| ID | ... | Creation date | 2008 November |
| Platform | S60 3rd,3rd FP1, 3rd Fp2 | Tested on devices | N78 |
| Category | Symbian C++ | Subcategory | General |
| Keywords (APIs, classes, methods, functions): keywords=TDriveInfo,TDriveInfo::Drive(),TDriveInfo::Volume() |
This snippet can be self-signed.
If the user application needs to write a big file into the memory card, the application should check the available free space before the operation. The following snippet provides a solution to this.
//necessary library
LIBRARY efsrv.lib
//necessary header file
#include <f32file.h>
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 == EMediaNANDFlash)
{
//recode its free space in bytes
fileSession.Volume(volumeInfo,driveNumber);
freeKBytes = volumeInfo.iFree/1024;
freeSpace.Num(freeKBytes);
break;
}
}
....
//close RFs session
fileSession.Close();
The freeSpace variable the free memory space in bytes, on the memory card.
Internal Links:
No related wiki articles found