I saw few threads about it but still no clue how to fix that error. The thing is:
char *data;
char chat;
snprintf(chat,"%d",getc(file));//error here
printf("\Variable %c",chat); // here is still valid
strncpy(data, chat, SHM_SIZE); //error here
Please help 🙂
sprintf – gives error (int to char conversion);
atoi/itoa – not working :/
Edit: @iharob
thank you! i still have a problem….
strncpy(data, "a", SHM_SIZE); //is totally working
but
char chat[SHM_SIZE];
snprintf(chat, sizeof chat, "%d",getc(file));
printf("Variable %c\n", chat);//showing nothing or some weird signs
weird because
printf("Character : %c",getc(file)); //shows everything ok
Best Answer
This could be done with the following
please read the snprintf manual