[Gambas-user] Capturing or redirecting print output

Rob Kudla sourceforge-raindog2 at ...94...
Wed Mar 29 17:14:03 CEST 2006


On Wed March 29 2006 02:06, GuruLounge - MailLists wrote:
> Is there a way to redirect or capture the "print" standard
> output so I can display it in a textarea?

It's definitely possible, but you would probably have to do 
something complicated like create a named pipe and redirect the 
output of your program to that pipe, then open that pipe in 
Gambas and read from it to populate the text area.

Instead, I'd recommend writing a MyPrint method that handles 
writing to the text area, so that it's a quick job to redirect 
the output wherever you want rather than having to edit every 
Print statement in your project.  You could just do one search 
and replace and that would be the end of it (well, assuming 
there are no Print # statements in your project.)

Rob




More information about the User mailing list