drkcore

2009/10/14 06:22:34

Unix/Linuxプログラミング理論と実践 11章 (popen)

11.4 popenを書く

pipeしてforkして親の標準入力をパイプにつないで、この標準出力をパイプにつないで、execlでsh -c commandを実行する

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

shの-cオプションはコマンドを実行して終了する。

-c string If the -c option is present, then commands are read from string.  
If there are arguments after the string, they are assigned to the positional 
parameters, starting with $0.

Comments