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 1 4205
(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 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 comma.
For example: BENL LT, RAT LT
At the moment, I've got the VBA bits working on the single
ID stuff, but, should it come across a list like the above,
|
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";
.....
sscanf(foo,"%s%*%s%*%s%*%s%*%s",s1,s2,s3,s4,s5);
<snippet/>
This is giving me junk .
|
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; hj-54-56; 1565.00; 0
8228880; 30-56-tw; 3295.50; 0
0022339; hs-sa-73; 2975,75; 0
.... etc
|
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 the first character is an
integer it will allow letters in the following places
for Example:
|
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 do in the below
code. Its main code, all the functions are defined well. So just wanna
know how to include some extra code to open the file and read each
line.
Thanks a lot
typedef struct
{
|
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 for the given user word n then only futher procedure shud happen.
this table has 2 columns one is library(colum has only one word present) is linked to another table of the same DB and other column has this synonyms (synonym of the word in...
|
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:
<presence/absence of n space/tab on the first n lines>
12
<presence/absence of n space/tab here>0<presence/absence of n space/tab
here>90 10 23 43 0 0 0 0 0 0 0
90 0 0 0 0 88 0 0 0 ...
|
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 );
originalString contents are something like:
char originalString="1,my text here 1,my text here 2";
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |