C++: malloc : erreur: invalid conversion from ‘void*’ to ‘u_int8_t*’

J'ai eu ce problème:

invalid conversion from ‘void*’ to ‘u_int8_t*’

Quand vous faites cela:

int             numBytes;
uint8_t         *buffer;

buffer=malloc(numBytes); //error here, why?

ou doit-je mettre comme ça?

buffer=malloc(numBytes); 

Veuillez l'expliquer.

Utilisez un pointeur intelligent de quelque sorte.

OriginalL'auteur olidev | 2010-10-24