2

I have seen this sample written in Ruby code, how i can simulate it in C language?

  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
aarona
  • 35,986
  • 41
  • 138
  • 186
alaamh
  • 963
  • 2
  • 9
  • 14
  • 1
    [This question](http://stackoverflow.com/questions/280571/how-to-control-popen-stdin-stdout-stderr-redirection) is a good start for learning about `popen`. – maerics Apr 26 '10 at 10:24

1 Answers1

2

The popen man page has an example that should help:

http://www.opengroup.org/onlinepubs/009695399/functions/popen.html

Michael Kohl
  • 66,324
  • 14
  • 138
  • 158