本文整理汇总了C++中CFileWriter::WriteBlockL方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileWriter::WriteBlockL方法的具体用法?C++ CFileWriter::WriteBlockL怎么用?C++ CFileWriter::WriteBlockL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileWriter
的用法示例。
在下文中一共展示了CFileWriter::WriteBlockL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTestStepL
//.........这里部分代码省略.........
INFO_PRINTF1(_L("Starting Incremental Encryption..."));
for(TInt i = 1 ; i <= numBlocks ; i++)
{
TRAP_LOG(err,srcData->ReadBlockL());
//Create buffer for encrypted data
TInt maxOutputLength = impl->MaxFinalOutputLength(TPtrC8(*srcData).Length());
HBufC8* encrypted = HBufC8::NewLC(maxOutputLength);
TPtr8 encryptedPtr = encrypted->Des();
if(i == numBlocks)
{
TRAP(err,impl->ProcessFinalL(*srcData, encryptedPtr));
if(err != KErrNone)
{
ERR_PRINTF3(_L("*** ERROR:%d - ProcessFinalL() Block=%d ***"),err,i);
User::Leave(err);
}
}
else
{
TRAP(err,impl->ProcessL(*srcData, encryptedPtr));
if(err != KErrNone)
{
ERR_PRINTF3(_L("*** ERROR:%d - ProcessL() Block=%d ***"),err,i);
User::Leave(err);
}
}
TRAP_LOG(err,encryptedDataWriter->WriteBlockL(encryptedPtr));
CleanupStack::PopAndDestroy(encrypted);
}
CleanupStack::PopAndDestroy(encryptedDataWriter);
//Switch to Decrypt Crypto Mode
TRAP(err,impl->SetCryptoModeL(KCryptoModeDecryptUid));
if(err != KErrNone)
{
ERR_PRINTF3(_L("*** ERROR:%d - SetCryptoModeL() i=%d ***"),err,index);
User::Leave(err);
}
//If in CTR mode need to reset the keystream to the start of the sequence used for encryption.
if(TUid(operationMode) == KOperationModeCTRUid)
{
impl->SetIvL(iv->Des());
}
// the next step is to read the previously encrypted data
// from the temporary file decrypting this one block
// at a time and outputing this to a temporary file.
CFileReader* encryptedDataReader = CFileReader::NewLC(TPtrC(KTempEncryptedFilePath),blockSize);
CFileWriter* decryptedDataWriter = CFileWriter::NewLC(TPtrC(KTempDecryptedFilePath));
numBlocks = encryptedDataReader->NumBlocks();
INFO_PRINTF1(_L("Starting Incremental Decryption..."));