Phlip wrote:

> Now I work on replacing the temporary file with a data sink back into my
C++
> source.

That was so simple, I have probably screwed it up!

    static VALUE sink(VALUE self, VALUE input)
    {
        char * got = StringValueCStr(input);
        cout << got << endl;  //  todo - replace this with something that
routes the data where I need it
        return Qnil;
    }
....
    ruby_init();
    ruby_script("embedded");

    rb_define_global_function("sink", RUBY_METHOD_FUNC(sink), 1);

    int state(0);
    rb_eval_string_protect(
        "class MockStream   \n"
        "   def write(x)    \n"
        "       sink(x)     \n"
        "   end             \n"
        "end                \n"
        "$stdout = MockStream.new()\n"
//        "$stdout.reopen(File.open('c:/temp/redirect.txt', 'w'))\n"
        , &state);
    if (state)  {  cout << error_print(state) << endl;  return 1;  }

    rb_eval_string_protect("puts 'hello world'\n", &state);
    if (state)  {  cout << error_print(state) << endl;  return 1;  }

It works for 'puts', but I don't know

I will proceed with it until something croaks. The _protect makes this
strategy safe!

> -- 
>   Phlip
>   http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces
>
>