×
Namespaces

Variants
Actions
(Difference between revisions)

How to check if device has memory card or not

From Nokia Developer Wiki
Jump to: navigation, search
WikiChecked (Talk | contribs)
m (Categorised)
savaj (Talk | contribs)
Line 26: Line 26:
  
 
Thanks to [http://mikie.iki.fi/lxr/source/ContextCommon/src/app_context.cpp Mika Raento] for this code.
 
Thanks to [http://mikie.iki.fi/lxr/source/ContextCommon/src/app_context.cpp Mika Raento] for this code.
 +
 +
Internal Links:
 +
* [[How to check disk drive storage space]]
 +
* [[How to check free space on memory card]]
  
 
[[Category:Symbian C++]]
 
[[Category:Symbian C++]]
 
[[Category:How To]]
 
[[Category:How To]]
 
[[Category:Code Examples]][[Category:Hardware]][[Category:Media]][[Category:Porting]]
 
[[Category:Code Examples]][[Category:Hardware]][[Category:Media]][[Category:Porting]]

Revision as of 00:58, 30 March 2009

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.

Internal Links:

115 page views in the last 30 days.
×