473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

sscanf reading null

I am reading a line and then using sscanf to split it into individual fields.

But, somehow sscanf is reading the first character as null.

I have four fields in my line separated by tabs. I need to check the presence of these 4 fields and also the 3 tabs separating the fields.

Sample line: + 12345678 23.22 Initial

My format string for sscanf is
Expand|Select|Wrap|Line Numbers
  1. sscanf(transstr,"%c%[\t]%ld%[\t]%lf%[\t]%s",&TransType,&tab1,&sectime,&tab,&amount,&tab,Description) != 7
  2.  
Help needed guys!!
Sep 10 '10 #1
1 3843
weaknessforcats
9,208 Expert Mod 8TB
+ 12345678 23.22.

Use scanf().

First: scanf() for the +
Second: scanf() for the integer
Third: scanf() for the 23.22

Verify these all work indivually.

Then merge the three scanf() calls into a single
sscanf().
Sep 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: whisper | last post by:
Hello: I am trying to write code to read in a bunch of lines from stdin, each containing a (variable) number of integers and writing each integer in a separate line to stdout. I came up the...
8
by: nabil m | last post by:
please help - i have a field that is null in my sql database - i am using C# i getthis error everytimethe fild is null - how do i check to see if the field in my DB is null then output an empty...
4
by: chambersdon | last post by:
I have an application that needs to insert nulls into the database and I don't seem to be able to do this. I am currently trying to do this with a Typed DataSet but I can't seem to Insert Nulls...
2
by: Jim Langston | last post by:
Microsoft Visual C++ .net 2003. I was just curious what numeric_limits for std::string would give me so wrote this: #include <iostream> #include <string> #include <limits> int main() {...
4
by: alphatommy_at_hotmail_dot_com | last post by:
Hi, I need to read data coming from serial port of type ushort(16-bits, unfortunately this can not be changed). I have tried reading using ReadChar (32-bits) and ReadByte(8 bits) with no...
5
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: ...
1
by: aditya83 | last post by:
Hi, We are trying to create a XML extract(with the help of another tool) and then send it to IBM WCC. I am not an expert in WCC, but the team developing the front end portal has expressed their...
4
by: utab | last post by:
Dear all, I have to interface some C code in C++, but I had a problem with sscanf function, it has been some time I have not used C and I could not figure out my problem. Simple code is below, I...
1
by: (2b|!2b)==? | last post by:
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(),...
7
by: monika varshney | last post by:
I have to read a database using dataset. My database has some null values. My code is working fine when there is a value in the database. But when there is a null value in the database, dataset...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.