Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Going to binary to hex, and back (in C)

Name: Anonymous 2007-12-07 13:46

i want to write a little pseudo assembler in C. (please don't tell me how stupid of an idea this is) Is there a built-in function in C that allows me to go from ascii chars --> binary. And then go from binary --> hex. Something along the lines of how atoi() works? I couldn't find anything, it would save me some time though.

Name: Anonymous 2007-12-07 14:54

>>1
Is there a built-in function in C that allows me to go from ascii chars --> binary. And then go from binary --> hex.
Hahaha oh wow
Lern2C

In C (actually, in computers), anything is a number. What you store in a char is a series of bits. You then choose to represent (display) it as a number, a character, an hexadecimal number, etc.

For example:

char c = 65;
printf("As a character: %c", c);
printf("As an integer: %d", c);
printf("Hexadecimal number: %H", c);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List