问题
I tried to compile this and got mistakes such as:
Error 4 error C2440: 'initializing' : cannot convert from 'void *' to 'char *'
This code is taken from here. Why doesn't it work?
DWORD dwRead=0;
char *lpData = (VOID*)GlobalAlloc(GMEM_FIXED, MAX_READ),
回答1:
You appear to be compiling with a C++ compiler, so you'll need an explicit cast:
char *lpData = (char *)GlobalAlloc(GMEM_FIXED, MAX_READ);
来源:https://stackoverflow.com/questions/15105980/error4error-c2440-initializing-cannot-convert-from-void-to-char