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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Direct I/O via /dev/tty; is this a shell limitation ??

Status
Not open for further replies.

StickyBit

Technical User
Jan 4, 2002
264
CA
Hi,

I have a question regarding terminal I/O via /dev/tty. If a C program reads input directly from /dev/tty (not standard input) is it possible for the shell to redirect input to a C program? In other words, can the shell redirect input to /dev/tty as if the input was coming directly from the terminal?

I’m 99% sure this cannot be done, and I will write a small C program to prove it (or not). I’m just not sure at this point in time as to why the shell has this limitation. If anyone can shed light on this topic it would be greatly appreciated.

echo blabla > /dev/tty

/Sticky
 
echo blabla > /dev/tty
The shell writes to the connected display device.
The C program doing terminal I/O via /dev/tty reads from the connected keyboard.

BTW, cross post: thread822-1041733

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top