I'm running the following code in C. I'm not getting the right answer.
int main()
{
char test[100] = "This_Is_A_Test_99";
char tmp1[10],tmp2[10],tmp3[10],tmp4[10],tmp5[10];
sscanf(test,"%[^'_'],%[^'_'],%[^'_'],%[^'_'],%s",tmp1,tmp2,tmp3,tmp4,tmp5);
printf ("Temp 1 is %s\n",tmp1);
printf ("Temp 2 is %s\n",tmp2);
printf ("Temp 3 is %s\n",tmp3);
printf ("Temp 4 is %s\n",tmp4);
printf ("Temp 5 is %s\n",tmp5);
return 0;
}
The output I get is
Temp 1 is This
Temp 2 is
Temp 3 is
Temp 4 is
Temp 5 is
What is that I have to do fetch "This" "Is" "A" "Test" and "99" on individual variables.