Question

Below is a part of my code. I am not sure what is wrong with it because when I debug this code, I get a the following error:

Unhandled exception at 0x60e8144c (msvcr90d.dll) in client0.exe: 0xC0000005: Access violation writing location 0x00000000.

This is somewhere in the line itoa.

CODE:

   int num =  LOWORD (lparam);
   char *number = NULL,*detail = NULL;
   (char*)itoa(num,number,10);
Was it helpful?

Solution 2

number is pointer and you haven't allocated memory for it. And then trying to write into it.

Update it to use array or allocate memory using malloc

int num =  LOWORD (lparam);
char number[20],*detail = NULL;
(char*)itoa(num,number,10);

OTHER TIPS

You have to pass a valid initialized pointer to itoa().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top