ming-ruby question

G

George Moschovitis

Hello everyone,

I would like to capture of Ming-Ruby in a Ruby String/StringIO.
I tried the following w/o success:

tmp = $stdout
flash = $stdout = StringIO.new
m.output
$stdout = tmp

The low level C output methods doesnt understand about
$stdout and keeps dumping bytes to the standard output.
Any ideas?

Thanks in advance for any help.
George.
 
L

Logan Capaldo

Hello everyone,

I would like to capture of Ming-Ruby in a Ruby String/StringIO.
I tried the following w/o success:

tmp = $stdout
flash = $stdout = StringIO.new
m.output
$stdout = tmp

The low level C output methods doesnt understand about
$stdout and keeps dumping bytes to the standard output.
Any ideas?

Thanks in advance for any help.
George.

--
www.navel.gr | tel: +30 2106898050 | fax: +30 2106898437

web appliction engine: http://www.navel.gr/nitro
have fun: http://www.joy.gr
Well this idea is a hack obviously but have you tried:

# mingout.rb
...
ming.output

# mingin.rb
m = IO::popen("mingout.rb")
data = m.read

The massive downside to this is that it requires two programs, and I
am sure there is
a better way, but it should work
 
G

George Moschovitis

Well i dont want 2 programs...
I dont want ot save to a file with m.save('filename') and use File.read
to get
the data either, any other solution?

-g.
 
L

Logan Capaldo

Well i dont want 2 programs...
I dont want ot save to a file with m.save('filename') and use File.read
to get
the data either, any other solution?

-g.
Well I downloaded the ming source, and looked at the code for the
output method. It uses putchar() directly. You'd probably have to
patch the ming source and create a method that could use fputc( ) and
took a FILE* or something similiar (suitably wrapped up in a ruby
object) as an argument. Sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top