E D R S I H C RSS
ID
Password
Join
Preserve the old, but know the new.

FrontPage FileCopy

# simple file copy
# 2011. 1. 7

from = File.open("test.png", "rb:binary")
data = from.read
from.close

to = File.open("test2.png", "wb:binary")
to.write(data)
to.close

* More ruby style code

File.open("test.png", "rb:binary") { |from| $data = from.read }
File.open("test2.png", "wb:binary") { |to| to.write($data) }
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2011-01-07 23:53:00
Processing time 0.0244 sec