Launching C executable via ruby script on Ubuntu server -


i have situation need assistance with. involves ruby, rails, , native c applications running on ubuntu server.

i able compile c applications on server , need know how launch them via ruby script.

my end goal take lists of data rails app, save them specific .dat file on server, use file input executables (along flags), , load resulting files through ruby script rails app display.

i'm looking @ these start:

confirm existance of executable (script, bat, cmd, exe) via ruby file

launch script on separate server rails app

confirm existance of executable (script, bat, cmd, exe) via ruby file

ruby require_relative executing script?

if has done or has ideas of how please advise.

you can this

original_file_path = 'path/to/original_file.dat' modified_file_path = 'path/to/modified_file.dat'  file.write(file_path, 'data')  #this return output c program #use if need parse output c program result = `some_c_executable --some_flag #{file_path}` #parsing result... data = file.read(modified_file_path) #work data 

or

#if don't need output c program, use "system" #it returns true or false according success result = system "some_c_executable --some_flag #{file_path}" if result   data = file.read(modified_file_path)   #work data else   ... end 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -