 
 
 
 
 
   
| [ | 
| l]print_code_table.c 
/*
 * print_code_table.c --- ASCII コード表 (印字可能な文字のみ) を表示する。
 */
#include <stdio.h>
main()
{
    int code;
    /* 0x20 (==32) から 0x7e (==126) までの数をコードとする文字を扱う */
    for (code = 0x20; code <= 0x7e; code++) {
        /* 4 つおきに改行 */
        if (code % 4 == 0)
            printf("\n");
        /* 16 進数, 10 進数, 文字 として表示 */
        printf("0x%02x (%3d): %c    ", code, code, code);
    }
    printf("\n");
}
 | 
C 言語の知識として
 
%x という書式を用いる。
 
 
 
 
 
   
 Next: 3.4 日本語の文字コード
Up: 3 テキスト・ファイル
 Previous: 3.2 英数字の文字コード (ASCII)
Masashi Katsurada 
平成20年10月18日