variable type char to variable type int

This is a discussion on variable type char to variable type int within the C Programming forums, part of the General Programming Boards category; I'm trying to take a variable from type char to type int. I'm reading in the values as an array ...

  1. #1
    Unregistered
    Guest

    variable type char to variable type int

    I'm trying to take a variable from type char to type int. I'm reading in the values as an array of characters, but these characters really represent numbers in hex. I can read in the string fine and print out the characters fine, I just can't seem to output the values as an integer. The strings vary between 2 bytes, 4 bytes and 28 bytes. So I need to be able convert each of these fairly quickly. Right now, I'm trying to set up an array with the different mulitplier values to use while converting, but is there an easier way?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    There's some example code here... it might not be exactly what you want, but it's a start.

    If it doesn't help, post what code you have and someone will help out.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 11-30-2007, 02:51 AM
  2. Replies: 16
    Last Post: 10-29-2006, 04:04 AM
  3. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  4. Replies: 2
    Last Post: 03-24-2006, 07:36 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM

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