问题
I am trying to find the syntax that will let me redirect standard input output toward a named pipe after using the mkfifo() function and creating a child process using fork.
Which man page should I be looking at for the syntax?
Thanks, Aaron
回答1:
Various sections of man page can serve your various purposes.
Generally,
Section 1 contain syntax for executable programs or shell command .
man mkfifo
Section 3 contain syntax for Library call ( used in c programs).
man 3 mkfifo
Edit: I think i misunderstood the question..if u need the syntax for a command for redirection, check
man dup
回答2:
Do you referred this
gives you idea about the syntax.
回答3:
You'll want to use the dup2
function. Standard Input is file descriptor #0 and Standard Output is #1.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html
来源:https://stackoverflow.com/questions/5649037/syntax-to-redirect-to-input-output-to-in-c-unix