Using sscanf to parse two strings out

Posted by Jessica on Stack Overflow See other posts from Stack Overflow or by Jessica
Published on 2010-05-20T19:35:47Z Indexed on 2010/05/20 19:50 UTC
Read the original article Hit count: 199

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about c

    Related posts about sscanf