Thread: hex to binary

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    30
    ^Thanks for that.

    But can you see I will have the problem where the binary string will be overloaded after a few inputs?
    The binary doesn't have to be a character string btw. I want to later separate the bits because these binary digits are machine codes for assembly instructions...
    Last edited by nasser; 09-11-2011 at 02:53 PM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nasser View Post
    ^Thanks for that.

    But can you see I will have the problem where the binary string will be overloaded after a few inputs?
    The binary doesn't have to be a character string btw. I want to later separate the bits because these binary digits are machine codes for assembly instructions...
    Well... you could always do this... char *Binary = malloc(4294967280 * sizeof(char));... in which case overrunning the binary buffer would be the least of our worries...


    Why won't it be overloaded? I actually tried it and it does.
    You defined binary as binary[128], each hex number takes 32 bits, so after a few inputs it will fill up the array.
    And you can't figure out to clear the buffer before you load the next value?

    Text-Binary is useless for anything but display. Your computer won't have the first clue what to do with it... Now if you were reading the hexcode and converting it to machine-binary, using fscanf("%x"... you might actually stand a chance of turning text-hex into machine code...

    EDIT: Get out your dictionary and look up "Example"....
    Last edited by CommonTater; 09-11-2011 at 03:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read binary, change a value, write to binary
    By mammoth in forum C Programming
    Replies: 16
    Last Post: 05-12-2011, 10:56 AM
  2. Converting From Binary Tree to Threaded Binary Trees
    By elton_fan in forum C Programming
    Replies: 15
    Last Post: 11-08-2007, 11:41 PM
  3. Replies: 3
    Last Post: 11-25-2006, 04:14 PM
  4. Replies: 0
    Last Post: 11-04-2006, 11:07 AM
  5. Characters to binary... hexadecimal to binary
    By Trauts in forum C++ Programming
    Replies: 48
    Last Post: 10-27-2002, 05:03 PM