×
Namespaces

Variants
Actions
Revision as of 03:40, 14 October 2011 by hamishwillee (Talk | contribs)

How to check if device has memory card or not

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (28 Jun 2007)
Last edited: hamishwillee (14 Oct 2011)
The following simple code tells if a device has a memory card or not.
{{{width}}}
TBool CMyContainer::HasMMC()
{
TBool iHasMMC;
iHasMMC=EFalse;
 
RFs fileSession;
fileSession.Connect();
 
TDriveInfo i;
if (fileSession.Drive(i, EDriveE)==KErrNone) {
if (i.iType!=EMediaNotPresent &&
i.iType!=EMediaUnknown &&
i.iType!=EMediaCdRom &&
i.iType!=EMediaRom) {
// memory card
iHasMMC=ETrue;
}
}
fileSession.Close();
return iHasMMC;
}

Thanks to Mika Raento for this code.

Internal Links:

87 page views in the last 30 days.
×