sscanf: how to parse
I'm trying to parse this string:
+CGDCONT: **0**,"IP","free","**10**.**158**.**88**.**34**"
In bold are the items i'm interested in.
My first attempt was to use this pattern:
"+CGDCONT: %d,\"IP\",\"%*s\",\"%d.%d.%d.%d\""
with it, only 1 variable is parsed.
Then, I tried:
"+CGDCONT: %d,\"IP\",\"free\",\"%d.%d.%d.%d\" // the string "free" is hard coded
It works but "free" might not be always "free", so I need a way to ignore it.
Then, I tried:
"+CGDCONT: %d,\"IP\",\"%s\",\"%d.%d.%d.%d\" // the string "free" is no more optional
With it, 2 variables are parsed. The second one (%s) is parsed as
free","10.158.88.34"\8 // \8 is ascii char 8.
How should I do?