Need help with sscanf()

closed account (DGvMDjzh)
I need help on manipulating strings with sscanf().

How do you split "123/456/789" into "123", "456" and "789".
And "123/456/789" into "123/456/" and "789".
Help would be highly appreciated.
closed account (zb0S216C)
Your format can be extracted with this call: sscanf("%d/%d/%d", ...);. With this call, the forward-slash is mandatory. Here's a full example:

1
2
3
unsigned int values[3] = {0};

sscanf("%d/%d/%d", &values[0], &values[1], &values[2]);


Wazzak
Last edited on
Topic archived. No new replies allowed.