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).