[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

updating a File

Afan Shah

11/16/2003 11:09:00 AM

Hi,

Could anyone please tell me how can I write to a file which already contains some data without erasing any previous data?

Afan.


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
1 Answer

ts

11/16/2003 11:17:00 AM

0

>>>>> "A" == Afan Shah <afan_shah@yahoo.com> writes:

A> Could anyone please tell me how can I write to a file which already
A> contains some data without erasing any previous data?

open it with "a", for example

svg% cat aa
a
svg%

svg% ruby -e 'File.open("aa", "a") {|f| f.puts "b"}'
svg%

svg% cat aa
a
b
svg%



Guy Decoux