Error c2440, PLEASE, PLEASE help
Hi, i'm trying to make a text editor, one of my functions should allow the user to open a file, i'm geting a a real nasty error in it......
This is the section that causes the problem....
pszFileText = GlobalAlloc(GPTR, dwFileSize + 1); //THE ACTUAL
//LINE Where the error is
The variables that have been used as parameters in the GlobalAlloc function, are fine, they've been setup and stuff else where.......
The error i'm getting is......
error C2440: '=' : cannot convert from 'void *' to 'char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Can anyone please please help, i would owe you my life.
>Conversion from 'void*' to pointer to non-'void' requires an
So you need to cast explicitly. I guess it has to look like this:
pszFileText = (char *) GlobalAlloc(GPTR, dwFileSize + 1);