[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

format speciiers for sscanf - reading a comma seperated string

(2b|!2b)==?

11/15/2008 2:26:00 PM

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_str(),
"%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
1 Answer

Victor Bazarov

11/15/2008 3:21:00 PM

0

(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_str(),
> "%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