Next | 5.1 More about IO | Prev |
The class IO has useful static methods:
IO.foreach("example.txt") { |line| puts line } array = IO.readlines("example.txt")
str = "" str << 1 << 2 << 3 # "\001\002\003" str << [ 65, 66, 67, 13 ].pack("c*") endl = "\n" $stdout << 3.1415926 << " Some binary data: " << str << endl
Next | Ruby for Perl programmers | Prev |