本文整理汇总了C++中AutoAlloc::ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoAlloc::ReadBytes方法的具体用法?C++ AutoAlloc::ReadBytes怎么用?C++ AutoAlloc::ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoAlloc
的用法示例。
在下文中一共展示了AutoAlloc::ReadBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/*********************************************************************\
Function name : CLanguageList::Init
Description :
Created at : 26.09.01, @ 16:11:23
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CLanguageList::Init()
{
Filename resourcepath = GeGetStartupPath() + Filename("resource");
AutoAlloc <BrowseFiles> pBrowse;
pBrowse->Init(resourcepath, false);
while (pBrowse->GetNext())
{
if (pBrowse->IsDir())
{
Filename fn = pBrowse->GetFilename();
if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
{
String idx = fn.GetString();
idx.Delete(0, 8);
Filename stringname = resourcepath + fn+Filename("c4d_language.str");
AutoAlloc <BaseFile> pFile;
if (!pFile)
return;
if (!GeFExist(stringname))
{
GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
}
else if (pFile->Open(stringname))
{
Int32 len = pFile->GetLength();
Char *buffer = NewMemClear(Char,len + 2);
if (buffer)
{
pFile->ReadBytes(buffer,len);
buffer[len]=0;
Int32 i;
for (i = 0; i < len && buffer[i] >= ' '; i++) { }
buffer[i] = 0;
for (i--; i > 0 && buffer[i]== ' '; i--) { }
buffer[i + 1] = 0;
AddLanguage(buffer, idx);
DeleteMem(buffer);
}
}
}
}
}
}
示例2: Load
IMAGERESULT BFFLoaderData::Load(const Filename& name, BaseBitmap* bm, Int32 frame)
{
Int32 y, bw, bh, header;
Bool ok = true;
UChar* line = nullptr;
AutoAlloc<BaseFile> file;
if (!file)
return IMAGERESULT_OUTOFMEMORY;
if (!file->Open(name, FILEOPEN_READ, FILEDIALOG_NONE, BYTEORDER_MOTOROLA))
return IMAGERESULT_FILEERROR;
file->ReadInt32(&header);
file->ReadInt32(&bw);
file->ReadInt32(&bh);
if (bw > 0)
line = NewMemClear(UChar, 3 * bw);
if (bm->Init(bw, bh, 24) != IMAGERESULT_OK || !line)
{
DeleteMem(line);
return IMAGERESULT_OUTOFMEMORY;
}
for (y = 0; y < bh && ok; y++)
{
// check if current thread is canceled and return IMAGERESULT_THREADCANCELED
file->ReadBytes(line, bw * 3);
ok = bm->SetPixelCnt(0, y, bw, line, COLORBYTES_RGB, COLORMODE_RGB, PIXELCNT_0);
}
ok = ok && file->GetError() == FILEERROR_NONE;
DeleteMem(line);
return ok ? IMAGERESULT_OK : IMAGERESULT_FILEERROR;
}