ttyname() - question

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Sep 1 08:37:51 AEST 1989


In article <2613 at incas.UUCP> tbecker at incas.UUCP (Thomas Becker) writes:
>So I tried to call ttyname(NULL) within test(), and it worked!

Only by accident.  You should use NULL only as a null pointer constant.
For a file descriptor that's associated with the terminal, try 2 (in a
UNIX environment), or, more portably, fileno(stderr).



More information about the Comp.lang.c mailing list