[plt-scheme] Redirect standard output from ffi C dll to DrScheme Interactions window

From: Thomas Chust (chust at web.de)
Date: Mon Feb 22 20:05:37 EST 2010

YC wrote:
> 
> On Mon, Feb 22, 2010 at 3:41 PM, Thomas Chust <chust at web.de
> <mailto:chust at web.de>> wrote:
> 
>     Eli Barzilay wrote:
>     > On Feb 22, Rodrigo Correia wrote:
>     >> [...]
>     >> My question is, how can i redirect the C standard output to DrScheme
>     >> interactions window?
>     >
>     > You can't.  If you really want to get close, you could fire up
>     > mzscheme as a subprocess, which would capture it's IO as usual.
> 
>     Hello,
> 
>     of course you *can* do that, it is just neither very portable nor
>     comfortable ;-)
> 
>  
>  
> Curious - why would it work out of box in mzscheme but not portable in
> DrScheme?  Do they use different code base or something?
> [...]

Hello,

mzscheme, being a "normal" command line executable, has a default
(current-output-port) that writes everything to file descriptor 1 just
like any old C program would do. Therefore, mixing C and Scheme output
code and running it in mzscheme works just fine as long as you don't
change the default output port setup.

drscheme and mred on the other hand use special output ports that write
text into GUI windows and the C code knows nothing about these ports.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


Posted on the users mailing list.