Hi, all!
The problem is:
I have a function:
Why do variable [tt]temp[/tt] has another length as the [tt]file.GetLength()[/tt] gives back? (one can see it in the TRACE output). In my case it was "temp <1560> VS file <1537>"
The problem is:
I have a function:
Code:
BOOL CMyClass::ReadFile(CString *path, CString *data)
{
CFile file;
if (!file.Open(*path, CFile::modeRead)) {
return FALSE;
} else {
try {
char *buf;
buf = (char*) calloc(file.GetLength(), sizeof(char));
ZeroMemory(buf,sizeof(buf));
file.Read(buf, file.GetLength());
CString temp="";
temp = buf;
TRACE("temp <%i> VS file <%i>", temp.GetLength(), file.GetLength());
*data = buf;
free(buf);
} catch (CFileException e) {
return FALSE;
}
file.Close();
return TRUE;
}
Why do variable [tt]temp[/tt] has another length as the [tt]file.GetLength()[/tt] gives back? (one can see it in the TRACE output). In my case it was "temp <1560> VS file <1537>"