Example #1
0
//读取存档
void TPlayerInfo::ReadPlayerInfo()
{

    RFs oFs;
    if (oFs.Connect())
    {
        return;
    };
    RFileReadStream oReadStream;
    //如果打开失败 将返回一个非0值,则返回
    if (oReadStream.Open(oFs, *iFileName, EFileRead))
    {
        oFs.Close();
        return;
    }
    //
    oReadStream.PushL();
    TInt32 playerCount;
    oReadStream >> playerCount;
    for (TInt i = 0; i < playerCount; i++)
    {
        if (i < AWARD_PLAYER_COUNT)
        {
            //iPlayerArray[i].InternalizeL(oReadStream);
            iPlayerList[i]->InternalizeL(oReadStream);
        }
    }
    oReadStream.Pop();
    oReadStream.Release();
    oFs.Close();
}
void CJavaDebugAgentSettings::LoadL(const TDesC& aPrefsFile)
{
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    RFileReadStream in;
    in.PushL();
    User::LeaveIfError(in.Open(fs, aPrefsFile, EFileRead));
    TRAPD(err, LoadL(&in));
    in.Close();
    in.Pop();

    if (err != KErrNone) {
        err = fs.Delete(aPrefsFile);
    }
    CleanupStack::PopAndDestroy(&fs);
}