Quick help

This is a discussion on Quick help within the C Programming forums, part of the General Programming Boards category; Hi, I am testing a function that translates 16- hex characters to 8 ASCII characters the characters are unsigned characters, ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    28

    Quick help

    Hi,

    I am testing a function that translates 16- hex characters to 8 ASCII characters the characters are unsigned characters, they produce a large numbers int the range 0 --> 255 which is
    correct, how can I take those valuses to Ascii char values ?

    here is the program:

    Code:
    code
    
    ByteType HexToAscii ( ByteType *Addr)
    {
      ByteType CH;
      
      CH = ( Addr [0] >= 'A' ? ( ( Addr [0] & 0xDF ) - 'A' ) + 10 :
           ( Addr [0] - '0' ) );
    
      CH *= 16;
    
      CH += ( Addr [1] >= 'A' ? ( ( Addr [1] & 0xDF ) - 'A' ) + 10 :
           ( Addr [1] - '0' ) );
    
      return(CH);
    }

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    Won't strtol() help you?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 10:33 AM
  2. recursive quick sort - stack overflow
    By Micko in forum C Programming
    Replies: 9
    Last Post: 01-01-2005, 04:51 PM
  3. Questions on basic Quick Sort
    By Weng in forum C++ Programming
    Replies: 4
    Last Post: 12-16-2003, 09:06 AM
  4. Quick Sort Help
    By NavyBlue in forum C Programming
    Replies: 1
    Last Post: 03-02-2003, 09:34 PM
  5. Replies: 0
    Last Post: 04-30-2002, 07:24 PM

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