[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
stdin/stdout/stderr problem in g++ and rails
From: |
Silver Spoon |
Subject: |
stdin/stdout/stderr problem in g++ and rails |
Date: |
Wed, 08 Dec 2010 15:42:23 -0000 |
User-agent: |
G2/1.0 |
In my rails controller, I am doing the following :
@output = `g++ j.cpp -o "prog" && ./prog`
This gives the output in the @output variable which i can display in
my view. But the above works only if the j.cpp is correct and doesn't
expect any user input. How can I use the stdin/stderr and stdout
streams here so that :
If the user has to give input, I open a dialog box on the view with a
textfield where he/she can enter the input, and the program continues
to execute.
If there are any errors in the file, then I should be able to get the
errors and display them to the user.
I tried doing this :
@output = `g++ j.cpp -o "prog" && ./prog| tee prog`
This allows me to enter the user input at the server command prompt
(the server log...i don't know what do we call it), but I want it to
be entered in a textfield in the view. Help me.
- stdin/stdout/stderr problem in g++ and rails,
Silver Spoon <=