Using sscanf to parse two strings out
- by Jessica
I have a semi xml formatted file that contains line with the following format:
<param name="Distance" value="1000Km" />
The first char in the string is usually a TAB or spaces.
I've been using the following to try to parse the two strings out (from name and value):
if(sscanf(lineread, "\t<param name=\"%s\" value=\"%s\" />", name, value) == 1)
{
//do something
}
name and value are char*
Now, the result is always the same: name gets parse (I need to remove the quotes) and name is always empty.
What am I doing wrong?
Thanks, code is appreciated.
Jess.