Thread: Ascii to hex and hex to Ascii

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    58

    Ascii to hex and hex to Ascii

    Hi everyone,
    Do you all have any idea on ascii to hex and hex back to ascii?
    I'm having a function that only take in char array input of eg."1A2B", I have to convert whatever I entered into as a string eg."ABCDE" to a hex format "xx". Not only that, I will have to convert it back to hex again.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    sscanf(inbuffer, "%x",&outInt); ?
    sprintf(outbuffer,"%X",inInt);?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Char to ASCII Hex Value Troubles
    By MattMik in forum C++ Programming
    Replies: 6
    Last Post: 03-25-2008, 02:17 PM
  2. Replies: 11
    Last Post: 03-24-2006, 11:26 AM
  3. Encrypting text file with ASCII hex
    By supaben34 in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2005, 06:35 PM
  4. Hex to Ascii conversion
    By Ryno in forum C Programming
    Replies: 2
    Last Post: 03-24-2005, 09:16 AM
  5. ASCII v's hex
    By sononix in forum C++ Programming
    Replies: 2
    Last Post: 01-20-2005, 05:18 PM