Ruby on Rails Saturday, July 31, 2010

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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment