Thread: Hex digits stored in char array.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    9

    Hex digits stored in char array - Question in response to your asnwer

    Hi. Sorry if this has been asked already, tried searching FAQ, and found a similar question, but not what I was looking for. Anyway, I'm trying to take an array with characters that represent hexidecimal digits.. something like "104B" and save it in another char array. However, in this array I will need two hex digits stored in each element. So I have:

    Code:
    typedef char byte;
    byte objectCode[4]; /* stores 4 bytes (8 hex digits) */
    So using "104B" as an example I would need to have
    objectCode[0] = 00010000 /* hex digits 10 in binary */
    objectCode[1] = 01001011 /* hex digits 4b in binary */

    I have no idea is there is a simple way to do this or not, any help would be greatly appreciated. Thanks.
    Last edited by Kevinmun; 11-18-2005 at 03:56 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-17-2008, 12:36 PM
  2. Replies: 11
    Last Post: 03-24-2006, 11:26 AM
  3. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  4. fill unsigned char array with hex values
    By luigi40 in forum C Programming
    Replies: 1
    Last Post: 06-25-2005, 05:56 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM