getting terminals of unix

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
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.