Symbian 文件追加

#include "CommonFramework.h"

#include <f32file.h>
#include <s32file.h>
#include <bautils.h>

LOCAL_C void doExampleL()
    {
    _LIT(KFileName, "c://yy.txt");
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);
    RFile file;
    CleanupClosePushL(file);
    if (BaflUtils::FileExists(fs, KFileName))
        {
        User::LeaveIfError(file.Open(fs, KFileName, EFileWrite));
        }
    else
        {
        User::LeaveIfError(file.Create(fs, KFileName, EFileWrite));
        }
    TInt pos = 0;
    file.Size(pos);
    RFileWriteStream writeStream(file, pos);
    writeStream.PushL();
    TBuf<10> fileContext(_L("file content"));
    writeStream.WriteL(fileContext);
    writeStream.CommitL();
    writeStream.Pop();
    writeStream.Release();

 

   CleanupStack::PopAndDestroy(&file);
    CleanupStack::PopAndDestroy(&fs);
    }

你可能感兴趣的:(c,user,File,include,Symbian)