static bool changeVariant(const std::string &url)
{
if (url.empty())
{
return false;
}
size_t dataLenth = 0;
//unsigned char *pFileData = crossUtil::AssetUtil::getInstance()->getFileData(url.c_str(), dataLenth);
FILE *pFile = fopen(url.c_str(), "rb");
if (!pFile)
{
return false;
}
fseek(pFile, 0, SEEK_END);
dataLenth = ftell(pFile);
char *pBuf = new char[dataLenth + 1];
rewind(pFile);
size_t length = fread(pBuf, 1, dataLenth, pFile);
if (length < 0)
{
return nullptr;
}
fclose(pFile);
}
c++获取文件大小
最新推荐文章于 2024-07-23 11:13:08 发布