http://www.programgo.com/article/88561662456/
cat readJpgFile.rb
jpg_read_file = File.open("Java程序员之路.jpg","rb")
write_file = File.new("Java程序员之路_copy.jpg","wb")
while true
begin
read_file = jpg_read_file.sysread(1) #表示一个字节一个字节的读取
write_file.syswrite(read_file)
rescue => e
puts e.message
break
end
end
puts "OK"
jpg_read_file.close
write_file.close
Paste_Image.png
网友评论