format speciiers for sscanf - reading a comma seperated string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • (2b|!2b)==?

    #1

    format speciiers for sscanf - reading a comma seperated string

    I have the following line in my code, which is supposed to skip commas
    and white space and to read a comma seperated value string into the
    appropriate variables:

    sscanf(temp.c_s tr(),
    "%f%*,%d%*,%f%* ,%d%*,%d%*,%f%* ,%f%*,%f%*,%f%* ,%d%*,%f%*,%d%* ,%d", &dt,
    &ti, &lsp, &lst, &lsv, &o, &h, &l, &bd, &bv, &ak, &av, &cv) ;


    I suspect the format specifiers are incorrect, since I am not reading
    the values correctly from the string - could anyone please suggest the
    correct format specifiers to :

    1). Igone commas
    2). skip any white space between the values/commas
  • Victor Bazarov

    #2
    Re: format speciiers for sscanf - reading a comma seperated string

    (2b|!2b)==? wrote:
    I have the following line in my code, which is supposed to skip commas
    and white space and to read a comma seperated value string into the
    appropriate variables:
    >
    sscanf(temp.c_s tr(),
    "%f%*,%d%*,%f%* ,%d%*,%d%*,%f%* ,%f%*,%f%*,%f%* ,%d%*,%f%*,%d%* ,%d", &dt,
    &ti, &lsp, &lst, &lsv, &o, &h, &l, &bd, &bv, &ak, &av, &cv) ;
    >
    >
    I suspect the format specifiers are incorrect, since I am not reading
    the values correctly from the string - could anyone please suggest the
    correct format specifiers to :
    >
    1). Igone commas
    2). skip any white space between the values/commas
    This is rather a C question. I think you'll have more luck asking C
    questions in 'comp.lang.c'.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    Working...