Programming: Where can I find an ASCII Table?

  • #1

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!
 

Answers and Replies

  • #2
I am not sure what your problem is. If you convert binary number to int and to char, it is already in ASCII.
 
  • #3
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.
 
  • #4
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
 
  • #5
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".
 

Suggested for: Programming: Where can I find an ASCII Table?

Replies
11
Views
549
Replies
4
Views
605
Replies
7
Views
954
Replies
2
Views
547
Replies
4
Views
885
Replies
4
Views
656
Replies
2
Views
2K
Replies
4
Views
2K
Replies
1
Views
586
Replies
20
Views
1K
Back
Top