Pelles C forum

C language => Tips & tricks => Topic started by: TimoVJL on April 02, 2012, 12:33:56 PM

Title: Console Char Table
Post by: TimoVJL on April 02, 2012, 12:33:56 PM
Print char table to console
If you copy that to bitmap and negative picture, it is printable.
See attachment.

Code: [Select]
// ConCharTbl.c
#include <stdio.h>

char print_chr(int c)
{
//if (c == 7 || c == 8 || c == 9 || c == 10 || c ==  13) return ' ';
if (c  >= 7 && c <= 13) return ' ';
return c;
}

int main(int argc, char **argv)
{
int i,k;
for (int j = 0; j < 8; j++) {
if (j < 3) printf(" \332\304\304\302\304\304\302\304\277");
else printf(" \332\304\304\304\302\304\304\302\304\277");
}
printf("\n");

for (int i = 0; i < 32; i++) {
printf(" \263%2d\263%2X\263%c\263",i,i,print_chr(i));
for (int j = 1; j < 8; j++) {
k = j * 32 + i;
if (j < 3) printf(" \263%2d\263%2X\263%c\263",k,k,k);
else printf(" \263%3d\263%2X\263%c\263",k,k,k);
}
printf("\n");
}
for (int j = 0; j < 8; j++) {
if (j < 3) printf(" \300\304\304\301\304\304\301\304\331");
else printf(" \300\304\304\304\301\304\304\301\304\331");
}
printf("\n");
return 0;
}
Title: Re: Console Char Table
Post by: CommonTater on April 03, 2012, 07:01:14 AM
Handy!  Thank you.