返回顶部

收藏

use the gets statement of the class File.

更多
file6 = File.new('C:\\Ruby\\Sample')
str=file6.gets
puts str

# In this code, the file6.gets statement will pass the contents of the file Sample to the str variable. The puts str statement will output the contents to the screen.

标签:Ruby,文件

收藏

0人收藏

支持

0

反对

0

发表评论