From: bbiker Date: 2006-07-14T10:35:10+09:00 Subject: Re: Appending to a CSV file I realize that I am jumping late into this thread. I do not understand why the responses to "How to append to a csv file" are so complex. Why do you need a csv module to create, edit, and/or add records to a csv file. As a newbie, I have written Ruby scripts that created csv file and appended records to existing csv files without having the need for a csv module. To append a record, I simply open the file in 'a' mode (have not needed the a+ mode yet), write the record to the file and then close file. I apolized if I am out of term and stuck my nose in the wrong place. Chris Hulan wrote: > James Gray wrote: > > On Jul 12, 2006, at 1:55 PM, Chris Hulan wrote: > > > >> it seems CSV only supports 'r','rb','w','wb' for open. > >> FasterCSV delegates to an IO object and supports all IO's modes. > >> So it would be the winner > > > > Interestingly, this design choice in FasterCSV has been questioned in > > the past. I just keep liking it more and more though as issues like > > this arise. :) > > > > James Edward Gray II > > It does seem a bit odd that CSV limits the modes. > > On the other hand, the desired result can be achieved by creating a > new file, copy existing data, add the new data, delete (or rename to be > safe) > the original and rename the new file to the old file name. > > I think supporting the append mode is easier all round... > > cheers > Chris > > -- > Posted via http://www.ruby-forum.com/.