HighDots Forums  

Running C processes, where do I put the C file?

Ruby On Rails Talk Ruby On Rails programming language mailing list


Discuss Running C processes, where do I put the C file? in the Ruby On Rails Talk forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Victor Martin
 
Posts: n/a

Default Running C processes, where do I put the C file? - 11-07-2009 , 07:24 AM






Hi there

I make a call jsut like this:

value = `./simulated_annealing`

Which is a C Object file, but Rails tells me it cannot find that file. I
put it in the same dir that the rest of the models files (since it's
called by one of those models), but I guess it should be in any other
place.

What do I have to do?
--
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 (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #2  
Old   
Frederick Cheung
 
Posts: n/a

Default Re: Running C processes, where do I put the C file? - 11-07-2009 , 09:03 AM






On Nov 7, 12:24*pm, Victor Martin <rails-mailing-l... (AT) andreas-s (DOT) net>
wrote:
Quote:
Hi there

I make a call jsut like this:

value = `./simulated_annealing`

Which is a C Object file, but Rails tells me it cannot find that file. I
put it in the same dir that the rest of the models files (since it's
called by one of those models), but I guess it should be in any other
place.

What do I have to do?
What the current directory is might depend on how you start the app,
but in general it is the top level of your app. Either chdir to the
folder containing your binary, use an absolute path or specify the
path relative to the current directory.


Fred
Quote:
--
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 (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #3  
Old   
Victor Martin
 
Posts: n/a

Default Re: Running C processes, where do I put the C file? - 11-07-2009 , 10:43 AM



Frederick Cheung wrote:

Quote:
What the current directory is might depend on how you start the app,
but in general it is the top level of your app. Either chdir to the
folder containing your binary, use an absolute path or specify the
path relative to the current directory.


Fred
Oh, I feel stupid. I just ran a "ls" command and it's just as you say,
it's in the top level.

Thanks!
--
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 (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #4  
Old   
Marnen Laibow-Koser
 
Posts: n/a

Default Re: Running C processes, where do I put the C file? - 11-07-2009 , 10:52 AM



Victor Martin wrote:
Quote:
Frederick Cheung wrote:

What the current directory is might depend on how you start the app,
but in general it is the top level of your app. Either chdir to the
folder containing your binary, use an absolute path or specify the
path relative to the current directory.


Fred

Oh, I feel stupid. I just ran a "ls" command and it's just as you say,
it's in the top level.
File.dirname(__FILE__) is great for constructing absolute paths on the
fly.

Quote:
Thanks!
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen (AT) marnen (DOT) org
--
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 (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
  #5  
Old   
Prasad Kulkarni
 
Posts: n/a

Default Re: Running C processes, where do I put the C file? - 11-08-2009 , 04:20 AM



Victor Martin wrote:
Quote:
Hi there

I make a call jsut like this:

value = `./simulated_annealing`

Which is a C Object file, but Rails tells me it cannot find that file. I
put it in the same dir that the rest of the models files (since it's
called by one of those models), but I guess it should be in any other
place.

What do I have to do?
Hi Victor,

Best option is to use absolute path for running the program. For ex.,
you can create a directory "bin" under your rails application top level
directory. Place your program under "bin" directory. Then you can
execute the program something like -

cmd = "#{RAILS_ROOT}/bin/cbin arg1 arg2"
value = `#{cmd}`

Thanks
-- Prasad
http://roorky.com
Interactive Programming Books
--
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 (AT) googlegroups (DOT) com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe (AT) googlegroups (DOT) com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.