×
Namespaces

Variants
Actions

How to check disk drive storage space

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: Den123 (27 Jun 2007)
Last edited: hamishwillee (30 May 2013)
Checks if free disk drive storage space is or will fall below critical level using class SysUtil.
static IMPORT_C TBool SysUtil::DiskSpaceBelowCriticalLevelL  (  
RFs * aFs,
TInt aBytesToWrite,
TInt aDrive
)

Include header: sysutil.h Link against: sysutil.lib

aFs - File server session. Must be given if available, e.g. from EIKON environment. If NULL, this method will create a temporary session, which causes the method to consume more time and system resources.

aBytesToWrite - Number of bytes the caller is about to write to disk. If value 0 is given, this method checks if the current disk space is already below critical level.

aDrive - Identifies the disk drive to be checked. Numeric values for identifying disk drives are defined in TDriveNumber enumeration.

Example:

TInt dataSize = 500;
if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFsSession, dataSize, EDriveC ) )
{
// Can not write the data, there's not enough free space on disk.
...
}
else
{
// It's ok to actually write the data.
...
}

Warning Note that this method, and all methods in SysUtil return -46 (KErrPermissionDenied) on some firmware versions of the Nokia N80 (see Archived:SysUtil API does not work in Nokia N80 (Known Issue) for more).


Internal Links:

This page was last modified on 30 May 2013, at 07:38.
59 page views in the last 30 days.