Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Base Changing Question In C++


  • Please log in to reply
No replies to this topic

#1 Genealogy Rules

Genealogy Rules

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:12:57 AM

Posted 27 September 2007 - 09:34 PM

I think this is going to be easy and I'm pretty sure I did this in beginner programming a few years ago without having to write a whole bunch of code to do so. I've been given a large file of hex numbers that I need to convert to decimal. This wouldn't be a problem if they had the 0x in front of them:

ie:
int x = 0x20;
cout << x; //prints 32 which is the decimal form.

Unfortunately, they are formatted like : 20 14 6f 3e


So, if I try to read each of these hex numbers from the file it's going to read them as a decimal which they are not due to no 0x prefix. Is there any way to read a number into the program and convert it easily without writing a large subroutine?

Thanks!

BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users