10 #define x2(x) (buffer[x] < 10 ? "0" : ""), buffer[x]
13 char *filename = NULL;
20 memset(readable, '\0', 9);
24 while (filename == NULL || *filename == '\0') {
25 printf("Please enter filename (q to exit):\r\n");
26 filename = get_input();
31 if ((file = fopen(filename, "r")) == NULL) {
32 printf("Could not open file\r\n");
37 if (fgets(buffer, 8, file) != buffer) {
38 printf("Could not read from file, bailing out\r\n");
41 for (i = 0; i < 8; i++)
42 if ( (buffer[i] >= 0x41 && buffer[i] <= 0x5A) ||
43 (buffer[i] >= 0xC1 && buffer[i] <= 0xDA) ||
44 (buffer[i] >= 0x30 && buffer[i] <= 0x39))
45 readable[i] = buffer[i];
46 else readable[i] = 0x2E;
47 printf("%s%x |%s%x %s%x %s%x %s%x %s%x %s%x %s%x %s%x| %s \n",
48 (c <= 0xF ? "0" : ""), c,
49 x2(0), x2(1), x2(2), x2(3),
50 x2(4), x2(5), x2(6), x2(7),
60 printf("File finished, press RETURN...\n");