Symbian 文件追加

阅读更多

#include "CommonFramework.h"

#include
#include
#include

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);
}

你可能感兴趣的:(Symbian,C,C++,C#)