use putchar() rather than printf("%c",...)