
-----------------------------------
Mackie
Tue Apr 08, 2008 3:53 pm

File IO?
-----------------------------------
How do you read/write/make new files in Ruby? I have an idea i must know!

-----------------------------------
Tony
Tue Apr 08, 2008 4:17 pm

RE:File IO?
-----------------------------------
Look into the File class.

contents = File::open("myfile.txt", "r").read


-----------------------------------
haskell
Wed Apr 09, 2008 5:09 am

Re: File IO?
-----------------------------------

File.open("enter_file_name", "r+") do |file|
  file.puts("This goes in the file!")
  file.puts("This also goes to the file!")
  lines = file.read  # Enitre file added to lines

  lines.each_line do |l|
    puts l
