Hi Paul,

On Apr 18, 2006, at 8:43 AM, Dobbs, Paul wrote:

I have a simulation writtin in c++ running on Linux. It outputs a series
of status reports to stdout. I'd like to use a RB program to display
those reports in a window, reading stdin in a loop, parsing the lines
from stdin, and displaying the results in editfields or statictexts.

However, it appears to be impossible to use stdin or StandardInputStream
in a graphical RB program. Is this true, or have I just not figured out
how to do it?

This is what the Shell is for. You can open an Interactive shell (Mode = 2), start your tool and monitor the Shell's DataAvailable and Completed Events to accept the data from the tool's stdout (and even send to the tool over stdin if needed) and display it however needed.

Create a new Shell Class called myShell in your project
Add an instance of myShell to your main window (now called myShell1 or you can rename it)
Select the myShell1 instance and change the mode to 2
Check the Events for myShell1 and you will see the "DataAvailable" and "Completed" events. Add Code to the DataAvailable event to catch and process your tool's stdout output. Add Code to the Completed event that handles the tool's finishing and exiting
In your main window, call myShell1.Execute "the tool command and args"

This should get you what you're looking for unless your tool is running and you're trying to attach to it. In that case, you might try redirecting stdout to a file in your tool, using a Shell and executing "tail -f /tmp/the_stdout_file" as the Shell's command instead of your tool and then using the same info above.

Tim

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to