Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i use stdin??

Status
Not open for further replies.

sixtoedsloth

IS-IT--Management
Jan 1, 2002
118
GB
Hi there,

i am trying to get the username , ttyp ,ip address and/or name into a c program on sco openserver 5.0.5

i tried utmp which gives me the username and ttyp, but i cant get the others, it doesnt seem to support ut_addr??

SO... i thought id pipe who -mxu from the command line
ie ./myprog | who -mxu

and use that. but how do i read stdin, anyone have an example of doing this??

cheers

Russ
 
You've got your pipe backwards. The way it's written, you're feeding stdout of your program to stdin of who.

As for reading stdin, you would do that the same way you read user input, i.e. use the cin input stream or gets()

Dennis
 
DOH!

its been a long night, yep, it works if you pipe the right way!!

Russ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top