本文整理汇总了C++中UnicodeString::sprintf方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::sprintf方法的具体用法?C++ UnicodeString::sprintf怎么用?C++ UnicodeString::sprintf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::sprintf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void __fastcall TForm3::AddItems(const int HowMany)
{
for(int i = 0; i < HowMany; i++) {
UnicodeString NextItemText;
NextItemText.sprintf(L"[%d] [%ls] [%ls%ls]", FTotal, names[FTotal % 9], Host, cats[FTotal % 4]);
FTotal++;
FStrings->Add(NextItemText);
}
FTotal++;
}
示例2: IntToHex
//---------------------------------------------------------------------------
UnicodeString IntToHex(uintptr_t Int, uintptr_t MinChars)
{
UnicodeString Result;
Result.sprintf(L"%X", Int);
intptr_t Pad = MinChars - Result.Length();
if (Pad > 0)
{
for (intptr_t I = 0; I < Pad; I++)
{
Result.Insert(L'0', 1);
}
}
return Result;
}
示例3: Int64ToStr
//---------------------------------------------------------------------------
UnicodeString Int64ToStr(__int64 Value)
{
UnicodeString Result;
Result.sprintf(L"%lld", Value);
return Result;
}
示例4: InitializeTranslationTable
void __fastcall TVersionInfo::InitializeTranslationTable(void)
{
#pragma pack(push, 1)
union TTranslationTableEntry
{
struct struct_Codes
{
WORD LanguageCode;
WORD CharsetCode;
} Codes;
DWORD RawData;
};
#pragma pack(pop)
void *xlatebuffer;
unsigned int BufferLength = 0;
UnicodeString TempString;
QueryValue(L"\\VarFileInfo\\Translation",xlatebuffer, BufferLength);
TTranslationTableEntry* ATranslationTableEntry;
ATranslationTableEntry = static_cast<TTranslationTableEntry*>(xlatebuffer);
// We assume that the translation table is stored correctly;
// the operating system provides no other means to retrieve
// the count of items, so dividing table size by
// sizeof(table entry) is the only means to achieve this.
assert(BufferLength % sizeof(TTranslationTableEntry) == 0);
while (BufferLength != 0)
{
TempString = L"";
TempString.sprintf(L"%.4X%.4X", ATranslationTableEntry->Codes.LanguageCode,
ATranslationTableEntry->Codes.CharsetCode);
FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(ATranslationTableEntry->RawData));
ATranslationTableEntry++;
BufferLength = BufferLength - sizeof(TTranslationTableEntry);
}
if ((FTranslations->Count == 0) && FHasVersionInfo)
{
// Interestingly, there was *NO* translation
// data stored inside the buffer - for whatever
// reason there might be.
// The operating system mandates a language-charset
// identifier, though, when it comes to querying
// for string data.
// Resolution: create a fake entry which is
// language-neutral and which uses
// the Unicode charset.
TTranslationTableEntry TranslationCode;
TranslationCode.Codes.LanguageCode = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
TranslationCode.Codes.CharsetCode = 0x04b0; // Unicode
TempString = L"";
TempString.sprintf(L"%.4X%.4X", TranslationCode.Codes.LanguageCode,
TranslationCode.Codes.CharsetCode );
FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(TranslationCode.RawData));
}
// By default pick the first language-charset entry
// for display / analysis.
FLanguageCharsetIndex = 0;
}