Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uwmcsd1!lakesys!davek From: davek@lakesys.UUCP (Dave Kraft) Newsgroups: comp.lang.c Subject: Re: getting users' tty # into a C program Summary: ttyname() doesn't work.. Message-ID: <444@lakesys.UUCP> Date: 5 Mar 89 23:15:56 GMT References: <441@lakesys.UUCP> <9794@smoke.BRL.MIL> Organization: Lake Systems - Milwaukee, Wisconsin Lines: 29 In article <9794@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: > In article <441@lakesys.UUCP> davek@lakesys.UUCP (Dave Kraft) writes: > >I am writing a C program that need a user's tty number (i.e. tty3A). Is there > >any internal/external function that can accomplish this? > > Most UNIX systems have a ttyname() library function for doing this. > It doesn't work perfectly... Here's what I tried: main() { char *name; *name=ttyname(); printf("%s\n", *name); } (Plus I grepped around in all of the include files for ttyname, and I couldn't find it) Is there anything I'm doing wrong in the above program?? Thanks in advance. Dave -- davek@lakesys.lakesys.com -or- uunet!marque!lakesys!davek "The meek will inherit the earth, the rest of us will go to the stars" -- 'Omni' (magazine) button