How can I get the number of a string of 9 chars
char * str = "EJ:12345\n";
I tried
sscanf (str,"EJ:%d\n",&n)
but n
seems to be worth 0
How can I get the number of a string of 9 chars
char * str = "EJ:12345\n";
I tried
sscanf (str,"EJ:%d\n",&n)
but n
seems to be worth 0
I just tried this code and it works perfect:
char *str = "EJ:12345\n";
int n;
sscanf (str,"EJ:%d\n",&n);
printf ("%d\n",n);
Check if you are not using the variable "n" for something else. Greetings.