Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: ttyname() - question Message-ID: <10893@smoke.BRL.MIL> Date: 31 Aug 89 22:37:51 GMT References: <99@lkbpyr.UUCP> <2613@incas.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 6 In article <2613@incas.UUCP> tbecker@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).