J
Jatin Kumar
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.
In short, how can I get control of stdin, so that whenever the stdin
waits for some user input, i get to know that it is waiting for the user
input and then i can show the user a text field and get the user input
to be passed in the stdin stream.
Let me know if there's a doubt in the question.
@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.
In short, how can I get control of stdin, so that whenever the stdin
waits for some user input, i get to know that it is waiting for the user
input and then i can show the user a text field and get the user input
to be passed in the stdin stream.
Let me know if there's a doubt in the question.