From: Brian Candler Date: 2009-11-24T22:11:13+09:00 Subject: Re: ideas for a "parameter sweep" program? Diego Virasoro wrote: > I would like a generic solution that works with any language for any > program (including Fortran that doesn't allow to pass arguments form > the command line). So how do you pass parameters to your Fortran program - in a config file perhaps? If so, then just generate that file then run the program. It's up to you to code what you want. Does it read a flat file? XML? YAML? Something else? class FlatFileRunner def initialize(exe, conffile) @exe, @conffile = exe, conffile end def run(params = {}) File.open(@conffile, "w") do |f| params.each do |k,v| f.puts "#{k}=#{v}" end end %x{"#{@exe}"} end end prog = FlatFileRunner.new("./flurble", "./flurble.conf") res = prog.run("foo"=>123) puts "Result of experiment: #{res}" -- Posted via http://www.ruby-forum.com/.