By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,431 Members | 1,739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,431 IT Pros & Developers. It's quick & easy.

format speciiers for sscanf - reading a comma seperated string

P: n/a
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
Nov 15 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
(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
Nov 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.