File size: 381 Bytes
19605ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <conio.h>
#include <ctype.h>
#include <stdio.h>

int main() {
    printf("\nPress any keys -- Ctrl-D exits\n\n");

    while (true) {
        const int ch = getch();
        printf("0x%x", ch);
        if (isgraph(ch)) {
            printf(" '%c'", ch);
        }
        printf("\n");
        if (ch == 0x4) { // Ctrl-D
            break;
        }
    }
    return 0;
}