Saving files to harddrive

I’m wondering if it’s possible to save a file to a harddrive with Ruby.
I’ve googled it a few times but I never
get what I need. I know I can ‘write’ to a file, but it doesn’t actually
write to it on the harddrive, just during
that instance.

If anyone knows whether or not this is possible, that’d be great.

Thanks,
Corbin S.

On Dec 27, 2007 5:30 PM, Corbin S. [email protected] wrote:

I’m wondering if it’s possible to save a file to a harddrive with Ruby.

Of course

$ irb
irb> text = “Hello world\n”
=> “Hello world\n”
irb> File.open(“mytestfile.txt”, “w”) { |f| f.write(text) }
=> 12
irb> exit
$ cat mytestfile.txt
Hello World
$

That is “saving a file”

Mikel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs