문제

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);
도움이 되었습니까?

해결책 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);

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top