本文整理汇总了C++中Blob::Alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::Alloc方法的具体用法?C++ Blob::Alloc怎么用?C++ Blob::Alloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob::Alloc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrentDirectoryX
bool GetCurrentDirectoryX(std::basic_string<Char, Traits, Alloc>& out)
{
Blob<Char> buf;
//TCHAR* tsz = 0;
DWORD dwRet = 0;
bool r = false;
dwRet = GetCurrentDirectoryW(static_cast<DWORD>(buf.Size()), buf.GetBuffer());
if(dwRet)
{
if(dwRet > static_cast<DWORD>(buf.Size()))
{
// It needs more space.
if(buf.Alloc(dwRet+2))
{
if(::GetCurrentDirectory(static_cast<DWORD>(buf.Size()), buf.GetBuffer()))
{
out = buf.GetBuffer();
r = true;
}
}
}
else
{
out = buf.GetBuffer();
r = true;
}
}
return r;
}
示例2: LoadLibraryX
inline HMODULE LoadLibraryX(const Char* buffer)
{
Blob<wchar_t, false, BlobTraits<true, MAX_PATH> > t;
t.Alloc(StringLength(buffer) + 1);
t.GetWritableBuffer()[0] = 0;
XLastDitchStringCopy(buffer, t.GetWritableBuffer());
return LoadLibraryW(t.GetBuffer());
}
示例3: LoadStringX
inline int LoadStringX(HINSTANCE hInstance, UINT id, Char* buffer, int buffermax)
{
Blob<wchar_t, false, BlobTraits<true, 1024> > t;
t.Alloc(buffermax + 1);
t.GetWritableBuffer()[0] = 0;
int r = LoadStringW(hInstance, id, t.GetWritableBuffer(), buffermax);
XLastDitchStringCopy(t.GetBuffer(), buffer);
return r;
}