473,385 Members | 1,867 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,385 software developers and data experts.

Q: formatted integer extraction from ifstream

Hello.

I want to write a program that reads AutoCAD shape (font) files. They are
written with the convention that hexadecimal values have a leading zero and
decimal values do not. All numbers can be negative or positive. All numbers
can be stored in a single byte. My questions is: can ifstream extraction
into an int see the leading zero and interpret the number as hex and can I
ask the ifstream, right after the extraction, if the value I got was hex or
dec? Or do I have to peek for the possible sign and leading zero and set the
stream format to hex?

Thanks! James. :o)

Apr 23 '06 #1
1 2307
James Lehman wrote:
Hello.

I want to write a program that reads AutoCAD shape (font) files. They are
written with the convention that hexadecimal values have a leading zero and
decimal values do not. All numbers can be negative or positive. All numbers
can be stored in a single byte. My questions is: can ifstream extraction
into an int see the leading zero and interpret the number as hex and can I
ask the ifstream, right after the extraction, if the value I got was hex or
dec? Or do I have to peek for the possible sign and leading zero and set the
stream format to hex?

Thanks! James. :o)

Yes, it's pretty easy to set up:
is.setf(ios::fmtflags(0), ios::basefield);
-Pavel
Apr 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: The Roys | last post by:
Hi I have a textbox which displays a formatted numeric. eg: 100,000 When I retreive this value for calculations, it is valued at 100 eg: calc = val(txtbox) * 2 calc will equal 200, not...
18
by: Kevin Grigorenko | last post by:
Okay, i've got a file open, call it infile. I've got a simple while(!eof), but say the first line of my file is "<?xml version="1.0">", then it takes two iterations to get the string. first...
2
by: Steven T. Hatton | last post by:
I'm still not completely sure what's going on with C++ I/O regarding the extractors and inserters. The following document seems a bit inconsistent:...
13
by: coinjo | last post by:
Is there any function to determine the length of an integer string?
4
by: jm0 | last post by:
Hi, im developing this program, and then i ran into some trouble "oooh no!" hate to ask.. have search google and this page for something to spilt things up in arrays or whatever can be used, spent...
4
by: Gary Wessle | last post by:
Hi I am writing a code to open a space delimited data file, return the number of rows and columns, as well as return the nth column where n is user define number. I put all the cells in a...
7
by: pkirk25 | last post by:
My data is in a big file that I have no control over. Sometimes its over 30 MB and often there are several of them. It is machine generated and is nicely formatted. Example text follows: ...
7
by: zhouchengly | last post by:
when I use the following code to get integer values from file: void getIntegers() { vector<ItemType items; ifstream ifs("test.dat"); //¿¼ÂÇΪitemsÒ»´Î·ÖÅä¿Õ¼ä¡£ ItemType item ; while(...
4
by: Steve Rainbird | last post by:
Is there a way in DB2 I can get the current date and time formatted. In Oracle I could do the following select to_char(sysdate,'yyyymmdd') from dual returns 20070718
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
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,...
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
jinu1996
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 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.