BOOL GetFileSizeAndContent(const string& fileName, long& size, string& strContent)
{
FILE * pFile;
pFile = fopen( fileName.c_str(), "rb");
if (pFile == NULL)
{
return FALSE;
}
else
{
fseek(pFile, 0, SEEK_END);
size = ftell(pFile);
if (0 == size)
{
strContent = "";
fclose(pFile);
return TRUE;
strContent.resize(size);
fseek(pFile, 0, SEEK_SET);
fread((char*)&strContent[0], size, 1, pFile);
return TRUE ;
}
{
FILE * pFile;
pFile = fopen( fileName.c_str(), "rb");
if (pFile == NULL)
{
return FALSE;
}
else
{
fseek(pFile, 0, SEEK_END);
size = ftell(pFile);
if (0 == size)
{
size = 0;
strContent = "";
fclose(pFile);
return TRUE;
}
strContent.resize(size);
fseek(pFile, 0, SEEK_SET);
fread((char*)&strContent[0], size, 1, pFile);
fclose(pFile);
return TRUE ;
}