Method sscanf() ambiguous behavior
- by Carmen Cojocaru
I am trying to understand how sscanf() works. I ran some examples from this page: http://docs.roxen.com/pike/7.0/tutorial/strings/sscanf.xml and they don't work on my platform. I can't understand why.
For instance: "sscanf("4711bar", "%d%s", a, b);" makes the program exit with an error...
Here is one of the examples that work: "sscanf("foo", "f%s", a);".
Does anybody know why? Do they work on your platforms? Thank you.
This is my code:
int main(void){
char *b = (char*)malloc(sizeof(char)*100);
int a = 0;
sscanf("4711bar", "%d%s", a, b);
printf("%d", a);
printf("%s", b);
}