cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
getting terminals of unix
getting terminals of unix
Oct 6, 2009 at 2:00pm UTC
rajnp
(1)
Hi
i need to get the terminals that are connected to my unix box in a c program.
with
ttyname
function under unistd.h i am able to get the current terminal value.
is their any function/library to get all the terminals of a unix box. just like how "w" works.
thankyou
Oct 8, 2009 at 10:30pm UTC
PanGalactic
(1658)
The nice thing about open source software is that there are plenty of examples. The "w" program is part of the "procps" package. You can look at the source and find out how it is done there. My guess it that it is just reading the utmp file.
On Linux, check out the pty(7) man page.
Topic archived. No new replies allowed.