[cs631apue] Question about the project

Jan Schaumann jschauma at stevens.edu
Thu Oct 10 16:53:59 EDT 2013


Hui Zheng <hzheng5 at stevens.edu> wrote:
 
> When I implement the "-q" flag,
> I found it's not just about ASCII code.

Correct - that is why the manual page says "non-printable" characters,
and not "ASCII characters".

You can compare what the system ls(1) does.  Try this out:

ls ~jschauma/tmp/
ls ~jschauma/tmp | cat

(The Linux version does not appear to have a '-w' option corresponding
to ours, but it switches to printing all raw characters if not printing
to a terminal.)

isprint(3) is the correct library function to use here.

-Jan


More information about the cs631apue mailing list