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

Q: formatted integer extraction from ifstream

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


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.