If you use File.open you can put the code in a block also without having
to close the file after

File.open("testfile.txt", "w"){|f| f.puts t1,t2}


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sean Gallagher
Sent: 25 August 2005 21:21
To: '[email protected]'
Subject: RE: [Wtr-general] Writing values to a file


f = File.new("testfile.txt",  "a")
f.puts t1.to_s
f.puts t3.to_s

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tonny Brown
Sent: Thursday, August 25, 2005 5:01 AM
To: [email protected]
Subject: [Wtr-general] Writing values to a file

Hi there,

I was wondering how i can write some values to a file?

t1=Time.now
t2=3
t3=t1 + t2

puts t1
puts t3

f = File.new("testfile.txt",  "w")

How am I supposed to write the values of t1 and t3 to the file
testfile.txt?

thanks a lot


                
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs 
 
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to