2010-04-26 18 views
2

我看過用Ruby代碼編寫的這個示例,我如何用C語言來模擬它?將Ruby轉換爲C語言,有人會關心看看嗎?

Open3.popen3(command) do |stdin, stdout, stderr| 
     @stop_stdin = stdin 
     while !stdout.eof do 
     output = stdout.read(1024 * 100) 
     list_pipes.each do |out| 
      out.print output 
     end 
     end 
    end 
+1

[這個問題](http://stackoverflow.com/questions/280571/how-to-control-popen -stdin-stdout-stderr-redirection)是學習'popen'的好開始。 – maerics 2010-04-26 10:24:26

回答