How do I convert a LPVOID to char ?
char * pCacheMap;
pCacheMap = MapViewOfFile(hCacheMapping,FILE_MAP_READ|FILE_MAP_WRITE,0,0,0);
Error:
3 IntelliSense: a value of type "LPVOID" cannot be assigned to an entity of type "char *"
Error 1 error C2440: '=' : cannot convert from 'LPVOID' to 'char *'
Use a cast. Since LPVOID is a synonym for void * it is legal to cast it to any other pointer type so:
pCacheMap = static_cast<char *>(MapViewOfFile(...));
will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.