ming-ruby question

Discussion in 'Ruby' started by George Moschovitis, Dec 13, 2004.

  1. 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
    George Moschovitis, Dec 13, 2004
    #1
    1. Advertising

  2. On Mon, 13 Dec 2004 21:22:19 +0900, George Moschovitis <> wrote:
    > 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
    Logan Capaldo, Dec 13, 2004
    #2
    1. Advertising

  3. 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.
    George Moschovitis, Dec 13, 2004
    #3
  4. On Tue, 14 Dec 2004 05:37:19 +0900, George Moschovitis
    <> wrote:
    > 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
    Logan Capaldo, Dec 13, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jmdeschamps
    Replies:
    1
    Views:
    472
    Jeff Epler
    Apr 21, 2004
  2. jmdeschamps
    Replies:
    0
    Views:
    558
    jmdeschamps
    Jun 9, 2004
  3. titouille

    ming for python

    titouille, Dec 7, 2004, in forum: Python
    Replies:
    2
    Views:
    387
    Jack Diederich
    Dec 8, 2004
  4. =?ISO-8859-1?Q?Andr=E9_Roberge?=

    Using Ming on Windows

    =?ISO-8859-1?Q?Andr=E9_Roberge?=, Apr 23, 2005, in forum: Python
    Replies:
    1
    Views:
    346
    Do Re Mi chel La Si Do
    Apr 24, 2005
  5. J. D.
    Replies:
    1
    Views:
    143
    Roger Pack
    May 30, 2009
Loading...

Share This Page