Reputation: 107
When writing a program (Unix-style), can it address and manage more than one stdout and stdin channels?
Upvotes: 1
Views: 849
Reputation: 1374
By definition there is only 1 stdin and 1 stdout.
However, you may want to have a look at named pipes. With named pipes you could do something like:
mkfifo pipe1
mkfifo pipe2
cat a.a > pipe1
cat b.b > pipe2
yourapp pipe1 pipe2
Upvotes: 2
Reputation: 754760
No; there is (at most) one standard input and one standard output at any given time. Ultimately, since the question specifically mentions Unix, standard input is file descriptor 0 and standard output is file descriptor 1, and there is only one file descriptor with a given number.
Upvotes: 5