hmm, this seems to be a trivial program, or a I missing something?
I propose something like this:
Code: Select all
#include <stdio.h>
main()
{
char ch;
while(!feof(stdin))
{
ch = getchar();
printf("%o\n", ch);
}
}
to tweak it :
remove "\n" in the printf and substitute it with "\t" or with a blank space if you want results in a row.
This program outputs Octal values, change %o to %x for a hex output, %d for decimal integer and %u for unsigned.
for more info, do "man printf"
the feof() code is a bit rough.
Unix is user friendly. It is only careful selecting its friends.