本文整理汇总了C++中StringW::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ StringW::GetBuffer方法的具体用法?C++ StringW::GetBuffer怎么用?C++ StringW::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringW
的用法示例。
在下文中一共展示了StringW::GetBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveTranslationToFile
Long CModelScript::SaveTranslationToFile()
{
SizeT Length;
PTChar pszTransPath;
WChar szBuffer[0x1000];
CFileDisk file;
SScriptText *pText;
if (m_VecTextTranslation.size() == 0)
return SCR_ERROR_EMPTY_TRANSLATION_TEXT;
pszTransPath = (PTChar)szBuffer;
memcpy(pszTransPath, m_ScriptPath.GetBuffer(), (m_ScriptPath.GetLength() + 1) * sizeof(*pszTransPath));
GenerateTranslationFileName(pszTransPath);
if (!file.Open(pszTransPath, file.FILE_ACCESS_WRITE, file.FILE_SHAREMODE_READ, file.FILE_CREATE_ALWAYS))
return SCR_ERROR_IO_FAILED_OPEN;
Length = BOM_UTF16_LE;
if (!file.Write(&Length, 2))
return SCR_ERROR_IO_FAILED_WRITE;
Length = m_VecCharNameOriginal.size();
if (Length != 0)
{
SizeT i;
StringW *pCharName;
i = Length;
Length = wsprintfW(szBuffer, L"@Name=");
pCharName = &m_VecCharNameOriginal[0];
do
{
Length += wsprintfW(szBuffer + Length, L"%s,", pCharName->GetBuffer());
++pCharName;
} while (--i);
if (Length != 0)
{
*(PUInt32)&szBuffer[Length - 1] = 0x000A000D;
if (!file.Write(szBuffer, ++Length * sizeof(*szBuffer)))
return SCR_ERROR_IO_FAILED_WRITE;
}
}
pText = &m_VecTextTranslation[0];
for (SizeT i = m_VecTextTranslation.size(); i; --i)
{
Length = wsprintfW(
szBuffer,
L"@Text=%d,%d,%d,%s\r\n",
pText->PhysicalLine,
pText->LogicalLine,
pText->CharNameIndex,
pText->Text);
if (!file.Write(szBuffer, Length * sizeof(*szBuffer)))
return SCR_ERROR_IO_FAILED_WRITE;
++pText;
}
return SCR_ERROR_SUCCESS;
}
示例2: ComputeHash
Void Hash::ComputeHash(const StringW& string)
{
ComputeHash((PCByte)string.GetBuffer(), string.GetSize() * sizeof(WChar));
}
示例3: Compute
Void SymmetricCipher::Compute(const StringW& string)
{
Compute((PCByte)string.GetBuffer(), string.GetSize() * sizeof(WChar));
}