I am trying to execute a simple script from with a C program, but with
little success. The version of Ruby is 1.6.3, running under Linux and Cygwin
1.1.8 on Windows 2K. I get the same error on both systems.
The Ruby script, get.rb, is:
require 'net/ftp'
ftp = Net::FTP.new('savage', 'anonymous', 'jc@savage')
ftp.gettextfile('/pub/source_ftp.txt', 'gotten_ftp.txt' )
ftp.close
The ruby script works fine when run in the Ruby interpreter, but fails when
I put into my code. but when I run from the following C code:
#include <ruby.h>
int main( int argc, char** argv )
{
printf("Initializing the interpreter...\n");
ruby_init();
ruby_init_loadpath();
printf("Setting the runtime options...\n");
ruby_script( "embedded" );
rb_load_file( "get.rb" );
printf("Running the script...\n");
ruby_run();
printf("Done.\n");
return 0;
}
I get this error message:
[SAVAGE ~/ruby]$ ./ftpget.exe
Initializing the interpreter...
Setting the runtime options...
Running the script...
get.rb:1:in `require': No such file to load -- net/ftp (LoadError)
from get.rb:1
So where am I going wrong???
John