getting users' tty # into a C program
Joel Spolsky
spolsky-joel at CS.YALE.EDU
Mon Mar 6 08:42:15 AEST 1989
In article <9794 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <441 at lakesys.UUCP> davek at 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.
failing that try fd=popen("tty"); fscanf(fd,"%s",ttyname); close(fd)
+----------------+----------------------------------------------------------+
| Joel Spolsky | bitnet: spolsky at yalecs.bitnet uucp: ...!yale!spolsky |
| | internet: spolsky at cs.yale.edu voicenet: 203-436-1483 |
+----------------+----------------------------------------------------------+
#include <disclaimer.h>
More information about the Comp.lang.c
mailing list