Hex converter?

This is a discussion on Hex converter? within the C++ Programming forums, part of the General Programming Boards category; I was wondering if anyone knows how to create a Char to Hex converter, and a Hex to Char converter... ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    2

    Hex converter?

    I was wondering if anyone knows how to create a Char to Hex converter, and a Hex to Char converter...
    Thanks.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,915
    Depends on what you mean by "Char to Hex" conversion.

    If you're talking about taking an ASCII character and obtaining the hexadecimal number equivalent, then it should be as simple as creating an array that maps the values.

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Maybe this will help...

    Code:
    cin >> hex >> x;  //Get a number in hex format
    cout << "\t" << (char)x << "\t\t ASCII" << endl;  //Display an ASCII character
    Also, look-up atoi() (ASCII to Integer)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hex String to Decimal converter
    By wrex in forum C Programming
    Replies: 16
    Last Post: 11-05-2008, 05:06 PM
  2. Decimal to Hex Converter
    By rocketman03 in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:50 AM
  3. Hex Editing help and information please...
    By SG57 in forum C Programming
    Replies: 9
    Last Post: 06-25-2006, 12:30 AM
  4. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  5. Replies: 3
    Last Post: 01-23-2006, 06:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21