How can I create an fscanf format string to accept white space and comma (,) tokenization

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2010-05-19T15:41:12Z Indexed on 2010/05/19 16:40 UTC
Read the original article Hit count: 272

Filed under:
|

I've got some analysis code (myprog) that sucks in data using the following:

 if(5 == fscanf(in, "%s%lf%f%f%f", tag, & sec, & tgt, & s1, & s2))

which works just fine. But in the situation where I've got data files that are separated by commas, I'm currently doing something like:

 sed 's/,/ /g' data | myprog

Can I modify the format string in the fscanf() function to accept both delimitation formats?

© Stack Overflow or respective owner

Related posts about c

    Related posts about fscanf