Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to use file server sessions

The Rfs class represents a session with the file server. The following code demonstrates the use of the system default path and the session path and shows how to connect and disconnect to and from the file server.

 _LIT(KDefault,"Default path for fsSession is %S\n");
_LIT(KSession,"Session path for fsSession is %S\n"); 
RFs fsSession;
CleanupClosePushL(fsSession);
User::LeaveIfError(fsSession.Connect()); 
TFileName path;
User::LeaveIfError(fsSession.DefaultPath(path));
console->Printf(KDefault,&path);
User::LeaveIfError(fsSession.SessionPath(path));
console->Printf(KSession,&path); 
... 
... 
fsSession.Close();
CleanupStack::PopAndDestroy();

Use CleanupClosePushL() and CleanupStack::PopAndDestroy() so that fsSession is still closed if any of the User::LeaveIfError() functions leave.

See also How to use CleanupClosePushL().


Notes