Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!tektronix!tekecs!nobody From: nobody@tekecs.GWD.TEK.COM (-for inetd server command) Newsgroups: comp.lang.c Subject: Re: getting users' tty # into a C program Message-ID: <11106@tekecs.GWD.TEK.COM> Date: 7 Mar 89 18:56:07 GMT References: <441@lakesys.UUCP> <9794@smoke.BRL.MIL> <444@lakesys.UUCP> Reply-To: jeff@quark.UUCP (Jeff Beadles) Organization: Tektronix, Inc., Wilsonville, OR Lines: 42 In article <444@lakesys.UUCP> davek@lakesys.UUCP (Dave Kraft) writes: >Here's what I tried: > >main() >{ > char *name; > > *name=ttyname(); > printf("%s\n", *name); >} Try this; It should work. main() { char name[1025]; strcpy(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. Close, but not quite. Try this: % ar t /lib/libc.a | grep ttyname It should find a ttyname.o This is included by the loader when ld'ing your program automatically. Hope this helps, Jeff Beadles -- Jeff Beadles Utek Sustaining Engineering jeff@quark.WV.TEK.COM