[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

File writing

Justin To

6/25/2008 3:49:00 PM

Hi, I know you can write to a file using 'w', but this erases all the
previous data. How can I add new items to an existing document without
losing the data?

Thanks!
--
Posted via http://www.ruby-....

8 Answers

Tim Hunter

6/25/2008 4:02:00 PM

0

Justin To wrote:
> Hi, I know you can write to a file using 'w', but this erases all the
> previous data. How can I add new items to an existing document without
> losing the data?
>
> Thanks!

Use "a" instead of "w". That will Append new data to the end of the
file.
--
Posted via http://www.ruby-....

Michael Steinfeld

6/25/2008 4:10:00 PM

0

On Wed, Jun 25, 2008 at 11:48 AM, Justin To <tekmc@hotmail.com> wrote:
> Hi, I know you can write to a file using 'w', but this erases all the
> previous data. How can I add new items to an existing document without
> losing the data?


filename = File.open("test","a") do |f|
f.puts "append to file";
f.close();
end


>
> Thanks!
> --
> Posted via http://www.ruby-....
>
>

Justin To

6/25/2008 4:12:00 PM

0

Thank you!
--
Posted via http://www.ruby-....

Justin To

6/25/2008 4:50:00 PM

0

Hi again, how do I delete an item?
--
Posted via http://www.ruby-....

Justin To

6/25/2008 5:06:00 PM

0

Justin To wrote:
> Hi again, how do I delete an item?

...delete an item and take the now empty line away
--
Posted via http://www.ruby-....

Steve

10/9/2011 5:29:00 PM

0

On Sun, 9 Oct 2011 10:03:26 -0700 (PDT), wy <wy_@myself.com> wrote:

>On Oct 9, 12:55?pm, Steve <stevencan...@yahooooo.com> wrote:
>> On Sun, 9 Oct 2011 16:44:26 +0000 (UTC), "6250 Dead, 1393 since
>>
>> 1/20/09" <d...@gone.com> wrote:
>>
>> >http://www.alternet.org/teaparty/152...
>> >3A_wealthy_stockbrokers_more_dangerous_than_psychopaths/
>>
>> >Study: Wealthy Stockbrokers More Dangerous Than Psychopaths
>>
>> <LOL> @ alternet.org...
>
>No, Tufts University. From one of its professors. From one of his
>research studies. You know what a university is, don't you? A
>professor? A research study? Hmm. I thought not.

One small paraphrase from a professor from Tufts does not an article
make, you pathetic bozo, especially when the article dealt with
stockbrokers and the paraphrase had to do with political figures..

Any conclusion by the alternate freaks based on such a faulty premise
can only be met with.. <LOL> @ alternet.org...

Matt

10/9/2011 7:42:00 PM

0

On Oct 9, 11:03 am, wy <w...@myself.com> wrote:
> On Oct 9, 12:55 pm, Steve <stevencan...@yahooooo.com> wrote:
>
> > On Sun, 9 Oct 2011 16:44:26 +0000 (UTC), "6250 Dead, 1393 since
>
> > 1/20/09" <d...@gone.com> wrote:
>
> > >http://www.alternet.org/teaparty/152...
> > >3A_wealthy_stockbrokers_more_dangerous_than_psychopaths/
>
> > >Study: Wealthy Stockbrokers More Dangerous Than Psychopaths
>
> > <LOL> @ alternet.org...
>
> No, Tufts University.  From one of its professors.  From one of his
> research studies.  You know what a university is, don't you?  A
> professor?  A research study?  Hmm.  I thought not.

Please. Lentil Boy? Read? They didn't teach him that in prison.

Matt

Steve

10/9/2011 8:02:00 PM

0

On Sun, 9 Oct 2011 12:41:45 -0700 (PDT), Matt <matttelles@sprynet.com>
wrote:

>On Oct 9, 11:03?am, wy <w...@myself.com> wrote:
>> On Oct 9, 12:55?pm, Steve <stevencan...@yahooooo.com> wrote:
>>
>> > On Sun, 9 Oct 2011 16:44:26 +0000 (UTC), "6250 Dead, 1393 since
>>
>> > 1/20/09" <d...@gone.com> wrote:
>>
>> > >http://www.alternet.org/teaparty/152...
>> > >3A_wealthy_stockbrokers_more_dangerous_than_psychopaths/
>>
>> > >Study: Wealthy Stockbrokers More Dangerous Than Psychopaths
>>
>> > <LOL> @ alternet.org...
>>
>> No, Tufts University. ?From one of its professors. ?From one of his
>> research studies. ?You know what a university is, don't you? ?A
>> professor? ?A research study? ?Hmm. ?I thought not.
>
>Please. Lentil Boy? Read? They didn't teach him that in prison.
>
>Matt

"The total number of acres of crop land in the US is: 2,655,382 acres."
--matttelles@sprynet.com
http://groups.google.com/group/talk.politics.misc/msg/61f7f3da22b9...

Canyon Note:
Total cropland used for crops in the USA (2002) was
340 million acres, not <LOL> 2.6 million acres...
http://www.ers.usda.gov/publications/EIB14/...

Matt says the total cropland is about 250 sq ft per person when
it's actually well over 32,000 sq feet per person...