Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: How to update a file?
7stud --
5/11/2008 12:29:00 AM
Cheyne Li wrote:
> Hi there
>
> Does anyone know how to write a string at the end of a file?
contents = IO.read("data.txt")
print contents
puts
File.open("data.txt", "a") do |file|
file.print("this is the last line\n")
end
new_contents = IO.read("data.txt")
print new_contents
--output:--
hello
world
goodbye
hello
world
goodbye
this is the last line
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: How to update a file?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password