Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using CDirectFileStore

The following code fragment shows the creation of a new direct file store using CDirectFileStore::ReplaceLC(). Note that the direct file store object is assigned to a CFileStore pointer.

LOCAL_C void doMakeAndExternalizeL(const TDesC& aName)
    {
    ...
    TParse filestorename;
    fsSession.Parse(aName,filestorename);
    CFileStore* store = CDirectFileStore::ReplaceLC(
                        fsSession,
                        filestorename.FullName(),
                        EFileWrite
                                                    );
    ...
    }

In the following code fragment, an existing direct file store is opened using CFileStore::OpenLC().

LOCAL_C void doMakeAndExternalizeL(const TDesC& aName)
    {
    ...
    TParse filestorename;
    fsSession.Parse(aName,filestorename);
    CFileStore* store = CDirectFileStore::OpenLC(
                        fsSession,
                        filestorename.FullName(),
                        EFileWrite
                                                    );
    ...
    }

In both examples, fsSession is a handle to a session with the file server, an RFs type, declared elsewhere, and is assumed to be visible to both functions.