read() is closer to the metal, being a
kernel system call on Unix/Linux platforms.
You may use...
Code:
#include <ctype.h>
...
if ( isprint( (int)(i[l]) )
printf("%c ", i[l]);
else
putchar( '.' );
...
[offtopic]
It looks like you are trying to make a hex viewer. If you are interested, here's a a little,
x-platform hex-viewer for the console I wrote in C99 a year or two ago (I really don't remember
) in my spare time, just for fun.
It comes with source-code, although big parts of it are left in "1st draft mode". Documentation is not that great either (just a few .txt files)... same goes for comments in the code (big parts of them have no comments at all).
It also uses a tiny, autonomous x-platform preprocessor interface I wrote back then for color output on the console/terminal. A more recent version (not yet uploaded "officially" on my site) of that interface can be found
here, while it's documentation is available online
here.
Unfortunately, I no longer have too much spare time (to fool around :P) so it's not likely I will improve any of them any time soon (and oh boy, they certainly need improvements).
Nevertheless, perhaps (for some reason) they prove handy to somebody. So by all means feel free to play with them if you feel like it.
[/offtopic]