From: Sheen Zan Date: 2002-11-09T21:07:45+09:00 Subject: Re: Can I run other program in Ruby program and get result? ts,thanks. It works well under cygwin, but under Windows NT the result is "result : a.out". I think under Windows NT to do this must use WinAPI, so the result is different from that under Linux.Is it right? >>>>>> "S" == Sheen Zan writes: > >S> I write a hello world program using c++, which output "Hello world!", >S> I compile it into hello.o. Now, I want to write a Ruby program, which can run >S> hello.o in it and catch the output "Hello world!". What am I use in Ruby >S> to do this? > > Well, if you want to call an external program you can use `` > >igeon cat a.c >#include >main() >{ > printf("Hello world !\n"); >} >pigeon > >pigeon cc a.c >pigeon > >pigeon cat b.rb >#!/usr/bin/ruby >res = `a.out` >puts "result : #{res}" > >pigeon > >pigeon b.rb >result : Hello world ! >pigeon > > > >Guy Decoux         Sheen Zan         zx@is.pku.edu.cn           2002-11-09