×
Namespaces

Variants
Actions
(Difference between revisions)

How to check if device has memory card or not

From Nokia Developer Wiki
Jump to: navigation, search
rathodavinash (Talk | contribs)
(New page: The following simple code tells if a device has a memory card or not. <code cpp> TBool CMyContainer::HasMMC() { TBool iHasMMC; iHasMMC=EFalse; RFs fileSession; fileSession.Connect()...)
 
rathodavinash (Talk | contribs)

Revision as of 17:45, 28 June 2007

The following simple code tells if a device has a memory card or not.

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.

86 page views in the last 30 days.
×