I have various files of extensions .cpp stored on the server. When user clicks on the compile button, I should run gcc command passing the absolute path of the file to gcc compiler and then show the user the output of the file. How can i do that??? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jatin Kumar wrote:> I have various files of extensions .cpp stored on the server. When > user clicks on the compile button, I should run gcc command passing > the absolute path of the file to gcc compiler and then show the user > the output of the file. > How can i do that???A silly contrived example: user_controller.rb ---------------------- # GET /users # GET /users.xml def index @users = User.all @out = `ls -l /Users/robertwalker/Desktop` respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end index.html.erb ---------------------- <p>List of files on Desktop: <%= simple_format(@out) %></p> -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The above dummy code will only list the files in the directory, which is something i don''t really want. I want to individually run all these files with gcc compiler and then show the user the output/ errors in the process to the user, in front of each file. Now can you help me??? On Jul 31, 2:29 am, Robert Walker <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Jatin Kumar wrote: > > I have various files of extensions .cpp stored on the server. When > > user clicks on the compile button, I should run gcc command passing > > the absolute path of the file to gcc compiler and then show the user > > the output of the file. > > How can i do that??? > > A silly contrived example: > > user_controller.rb > ---------------------- > # GET /users > # GET /users.xml > def index > @users = User.all > @out = `ls -l /Users/robertwalker/Desktop` > > respond_to do |format| > format.html # index.html.erb > format.xml { render :xml => @users } > end > end > > index.html.erb > ---------------------- > <p>List of files on Desktop: <%= simple_format(@out) %></p> > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.