Can someone please help me.
I don't understand why this doesn't work.
should work out to:Code:
char *line, *tag, *a, *b;
int n;
strcpy(line, "This is an order for (XYZ-2) some order");
tag = strchr(line, '(');
strcpy(line, &tag[1]); // get rid of all text before and including (
sscanf(line, "%s%[-]%d%[)]%s",a, n, b);
a = "XYZ"
b = "some order"
n = 2
I tried
sscanf(line, "%s-%d)%s",a, n, b);
but it does the same thing.
wolf