# Programming: Where can I find an ASCII Table?

## Homework Statement

I am given the binary equivalent of ASCII codes and I am asked to decode a particular binary message (ASCII binary to actual ASCII character).

I am required to write it in C. Where can I get a text file of the ASCII code so I may create a look up table?

I googled, but I could not find a text file. And manually copying and pasting it into a document is not fun.

Thanks!

Related Engineering and Comp Sci Homework Help News on Phys.org
Borek
Mentor
I am not sure what your problem is. If you convert binary number to int and to char, it is already in ASCII.

Mark44
Mentor
You don't need a lookup table. Since what you start with already contains the ASCII codes for the characters in the message, all you need to do is separate the message into 8-bit chunks (bytes) and then print each one.

This code displays the character 'A'.
printf("%c", 0x41);

For example, if the ASCII string contains 43, 41, 54 (each in hex), printing them would result in C A T.

You mean if I have the following txt file:

Code:
01001001 01100110 00100000 01111001 01101111 01110101 00100000 01110111
01100001 01101110 01110100 00100000 01101101 01101111 01110010 01100101
00100000 01100101 01100110 01100110 01100101 01100011 01110100 01101001
01110110 01100101 00100000 01110000 01110010 01101111 01100111 01110010
I am able to decode the messages just by casting them to chars?

EDIT: I see. I did the following:

Code:
printf("%c", 01000111);
It seems to have done the trick. Thanks

Borek
Mentor
Not "just by casting". Your first number - 01001001 - is in fact 73 (dec). Convert it to a number and cast this number to char - and you will find it is "I".