#include int main(int argc, char* argv[]) { int c, x, y, row, len; char* line; FILE* pattern; pattern = fopen(argv[1], "r"); line = NULL; len = 0; for (c = 0; c < 256; c++) { while (1) { getline(&line, &len, pattern); if (line[0] == 'X') break; printf("%s", *line); } for (y = 0; y < 8; y++) { row = getc(stdin); printf("\t0x%02x, /* ", row); for (x = 7; x >= 0; x--) if (row & (1 << x)) printf("#"); else printf("."); printf(" */\n"); } printf("\n"); fseek(stdin, 8, SEEK_CUR); } while (1) { getline(&line, &len, pattern); if (feof(pattern)) break; printf("%s", line); } free(line); fclose(pattern); return 0; }