BOOL LoadFile(const char* file_name, vector<char>& vec_file);
BOOL Glob_Fun::LoadFile(const char* file_name, vector<char>& vec_file)
{
vec_file.clear();
if ((NULL == file_name))
return FALSE;
CFile file;
char szBuf[1024 * 10] = "", *pTmp = NULL;
int nRead = 0;
int file_len = 0;
if(FALSE == file.Open(file_name,CFile::modeRead))
return FALSE;
if(0 >= (file_len=file.GetLength()))
{
file.Close();
return TRUE;
}
vec_file.resize(file_len);
pTmp = &vec_file[0];
do
{
nRead = file.Read(szBuf, sizeof(szBuf));
memcpy(pTmp, szBuf, nRead);
pTmp += nRead;
}while (nRead > 0);
file.Close();
return TRUE;
}