This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

sscanf() problem

in following code sscanf does not work properly : It has some problems with [0-9]. could you please tell me why sscanf() doesn't work with [0-9].

int main()

{

char str[5][16] = {{0},{0},{0},{0},{0}};

char pstring[128] = "user 12345 admin login password";

sscanf( (Char *)pstring,"%s %[0-9] %s %s %s", str[0],str[1],str[2],str[3],str[4]);

printf("%s\n",str[0]);

printf("%s\n",str[1]);

printf("%s\n",str[2]);

printf("%s\n",str[3]);

printf("%s\n",str[4]);

return 0;

}

Try to add some alphabates /some non digit character in between the second string i.e. "12345" to verify the false behaviour.

I am using CCS v3.3.