Convert HEX string to bin

From: GIR (no_at_spam.com)
Date: 11/30/03


Date: Sun, 30 Nov 2003 12:11:20 +0100

Hi,

I've been trying to tackle the following problem but haven't been
succesfull so far.

I have string

char buffer[64];

which is filled with hexadecimal values, like this.

buffer[0] = A;
buffer[1] = 1;

buffer[0..1] combined make one value, 0xA1, which should be converted
into 10100001.

I know I could use sscanf to get the values out but sscanf is not an
option because it's too big.

Does anybody know a efficient way of converting these values?

TIA,
GIR



Relevant Pages

  • Re: Small Correction: Convert HEX string to bin
    ... >>succesfull so far. ... >>I have string ... >>I know I could use sscanf to get the values out but sscanf is not an ... buffer if always filled completely: ...
    (comp.lang.c)
  • Re: Convert HEX string to bin
    ... > succesfull so far. ... > I have string ... > I know I could use sscanf to get the values out but sscanf is not an ... unsigned char value; ...
    (comp.lang.c)
  • Re: Small Correction: Convert HEX string to bin
    ... GIR wrote: ... >> been succesfull so far. ... >> I have string ... >> I know I could use sscanf to get the values out but sscanf ...
    (comp.lang.c)
  • Re: Small Correction: Convert HEX string to bin
    ... >succesfull so far. ... >I have string ... >I know I could use sscanf to get the values out but sscanf is not an ... Just to avoid confusion. ...
    (comp.lang.c)
  • Re: CR & Tab in VB 2005 Textbox
    ... Secondly the CStr is converting as you saw to a string with that value. ... I do this since I use both VB and C# and sometimes I need to use code and if I use the Dot.Net functions provided by the objects rather than the VB it is easier to convert since it is mostly getting rid of ending semi colons and changing square brackets into regular brackets. ...
    (microsoft.public.dotnet.languages.vb)