How do you assign a characters ASCII value to a variable?
How do you assign a characters ASCII value to a variable?
Or, different from the above, you could know what the ASCII value is and apply it:
int a;
a = 0x4F;
or
a = 79;
-------------------------
zen, it could by a wise and creative idea for you to perhaps write a small program to display the ASCII table. Virtually any computer book will have an ASCII table somewhere in it.
Cheers guys
Here's a snippet you can run under DOS to display the displayable ASCII characters:
---
/*****
*
* MAIN
*
*****
*
* IN: void
* OUT: int - standard exit value
*
* NOTE: This is where it all starts and stops
*
*****/
int main(void)
{
unsigned char row,
column;
unsigned char byte;
row = 0x00; /* init vars */
column = 0x00;
byte = 0x00;
printf("\r\n\n THE ASCII TABLE\n\r-----------------\n\n\r");
for(row=0x00;row<0x10;row++) /* do the rows */
{
if(row == 0x00) /* first row, create columns headings */
{
printf(" | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n\r");
printf("----+-----------------------------------------------------------------\n\r");
};
printf(" %02X | ",(row<<4)); /* output row heading */
for(column=0x00;column<0x10;column++) /* do the columns */
{
if((byte < 0x08) || (byte > 0x0D)) /* if it's backspace, tab, etc, don't output */
printf(" %c ",byte);
else
printf(" ");
byte++;
};
printf("\n\r"); /* move to next row */
};
printf("\n\rTo use, add value at left to value at top. Example: 'N' = 0x4E.\n\r");
return(0);
}