Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
file_put_contents analog?
Joe Ruby
10/13/2006 8:27:00 PM
PHP has a function file_put_contents(file, stuff) -- is there any
similar single command in Ruby?
Thanks,
Joe
--
Posted via
http://www.ruby-...
.
1 Answer
Wilson Bilkovich
10/13/2006 8:33:00 PM
0
On 10/13/06, Joe Ruby MUDCRAP-CE <joeat303@yahoo.com> wrote:
> PHP has a function file_put_contents(file, stuff) -- is there any
> similar single command in Ruby?
>
file.puts(stuff)
If you don't already have the file in question open for writing:
File.open('some_file.txt','w') {|file| file.puts stuff}
File gets most of its useful functionality from its parent, IO:
http://www.rubycentral.com/book/ref...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
file_put_contents analog?
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