Syntax to Redirect to Input/Output to in C (UNIX)

依然范特西╮ 提交于 2019-12-12 06:17:02

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!