From: Lennon Day-Reynolds Date: 2004-08-24T03:23:33+09:00 Subject: Re: Stupid C... Greg, I'm trying to replace stdin with an open handle the currently-running binary itself, so that the Ruby interpreter can read the script file I've appended to the application directly, without an intermediate file being created. Basically, my code does the following: -- int this_fh = open(argv[0], O_RDONLY); lseek(this_fh, SCRIPT_OFFSET, SEEK_SET); fclose(stdin); dup2(this_fh, fileno(stdin)); -- The idea being tha, after all this, the Ruby interpreter will fire up and start reading from STDIN, which will be the application binary itself, from the first character of the embedded Ruby script I've appended to it. -- Lennon rcoder.net