Trying (and failing) to use an open Dialog box
I'm trying to use one of the common dialog boxes, and I'm using code from Petzold's book, but MSVC++ is throwing errors at me.
I have a function called PopFileRead():
Code:
{
BYTE bySwap ;
DWORD dwBytesRead ;
HANDLE hFile ;
int i, iFileLength, iUniTest ;
PBYTE pBuffer, pText, pConv ;
// Open the file.
if (INVALID_HANDLE_VALUE ==
(hFile = CreateFile (pstrFileName, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL)))
return FALSE ;
// Get file size in bytes and allocate memory for read.
// Add an extra two bytes for zero termination.
iFileLength = GetFileSize (hFile, NULL) ;
pBuffer = malloc (iFileLength + 2) ;
and on and on....
And i'm getting this error:
C:\Program Files\Microsoft Visual Studio\MyProjects\winpro2\File.cpp(76) : error C2440: '=' : cannot convert from 'void *' to 'unsigned char *'
Which is caused by the
Code:
pBuffer = malloc (iFileLength + 2) ;
What's going on?