本文整理汇总了C++中FilePtr::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::Size方法的具体用法?C++ FilePtr::Size怎么用?C++ FilePtr::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::Size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool DisplaySurface::Create(const boost::any& _rConfig)
{
CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig);
FilePtr pFile = NULL;
bool bResult = (NULL != pInfo);
{
pFile = FS::GetRoot()->OpenFile(pInfo->m_strPath, FS::EOpenMode_READBINARY);
bResult = (NULL != pFile);
}
if (false != bResult)
{
int sSize = pFile->Size();
unsigned char* pBuffer = new unsigned char[sSize];
sSize = pFile->Read(pBuffer, sSize);
bResult = SUCCEEDED(D3DXGetImageInfoFromFileInMemory(pBuffer, sSize, &m_oInfo));
if (false != bResult)
{
#pragma message(__FUNCTION__" : for better support some image formats must be converted into supported surface format. For example luminance image should be translated into paletted surface.")
bResult = SUCCEEDED(m_rDisplay.GetDevicePtr()->CreateOffscreenPlainSurface(m_oInfo.Width, m_oInfo.Height, m_oInfo.Format, D3DPOOL_DEFAULT, &m_pSurface, NULL));
}
if (false != bResult)
{
bResult = SUCCEEDED(D3DXLoadSurfaceFromFileInMemory(m_pSurface, NULL, NULL, pBuffer, sSize, NULL, D3DX_FILTER_NONE, 0xff000000, NULL));
}
if (false != bResult)
{
m_uBPP = m_rDisplay.GetFormatBitsPerPixel(m_oInfo.Format);
bResult = (0 != m_uBPP);
}
delete[] pBuffer;
FS::GetRoot()->CloseFile(pFile);
}
return bResult;
}
示例2: Loadfile
bool Lua::Loadfile(const string& _strFileName, LuaStatePtr _pState)
{
FilePtr pFile = FS::GetRoot()->OpenFile(_strFileName, FS::EOpenMode_READTEXT);
bool bResult = (NULL != pFile);
if (false != bResult)
{
int sSize = pFile->Size();
char* pSourceCode = new char[sSize + 1];
sSize = pFile->Read(pSourceCode, sSize);
FS::GetRoot()->CloseFile(pFile);
pSourceCode[sSize] = '\0';
_pState = (NULL == _pState) ? s_pState : _pState;
const int sResult = _pState->DoString(pSourceCode);
bResult = (0 == sResult);
delete[] pSourceCode;
if (false == bResult)
{
OutputError(sResult, _pState);
}
}
return bResult;
}