ttyname() - question

andrew.m.shaw ams at cbnewsl.ATT.COM
Fri Sep 1 00:16:41 AEST 1989


>From article <2613 at incas.UUCP>, by tbecker at incas.UUCP (Thomas Becker):
> The manpage of ttyname(3) says that the function takes a field descritor as
> an argument. So I tried to call ttyname(NULL) within test(), and it worked!

You were lucky that in your implementation the representation of NULL is the
same as the representation of (int)0, giving you stdin.  A field [sic] 
descriptor is properly an int, not a pointer.

	Andrew Shaw



More information about the Comp.lang.c mailing list