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 4177
(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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gary Smith |
last post by:
Hi, I've got a field that contains a list of rooms.
In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a...
|
by: Simone Mehta |
last post by:
hi All,
I am parsing a CSV file.
I want to read every row into a char array of reasonable size and then
extract strings from it.
<snippet>
char foo="hello,world,bye,bye,world";
........
|
by: Sick |
last post by:
My application populates a ListBox from a .TXT file. In the textfile there
are prices with both dots as well as comma's for decimal indication.
Example:
1234990; xg-tr-45; 1700,50; 0
2662666;...
|
by: Yogi_Bear_79 |
last post by:
I have the following code:
sscanf(line, "%d", n_ptr) !=1 || n_ptr <=0;
It only partially works. If the user types a character other than 0-9 to
start the string it fails. However as long as...
|
by: CJK |
last post by:
this is what i have so far:
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
class Person
{
|
by: anant |
last post by:
Hi all
The below code is reading string and then tokenizin it and reading all
the info. But i want to call a csv file and it should then read a
string from dt file. So what midification should i...
|
by: nehashri |
last post by:
i hv a database in access wid Asp as front end.
ven given a word in search command(of the front end) it shud go to a table in which each field has words serated by comma. each word shud b checked...
|
by: a |
last post by:
After reading FAQ comp.lang.c section 12 and googling again, still there is
no threads talking about reading a series of numbers. The input files,
somehow structured, is exemplified below:
...
|
by: jorba101 |
last post by:
I'm having following trouble:
I'm reading contents of a string retrieved from a CSV-like file with sscanf, in following way:
sscanf( originalString, "%d,%s,%s", &myInteger, myString1, myString2...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |