Anonymous user
Read a file character by character/UTF8: Difference between revisions
Read a file character by character/UTF8 (view source)
Revision as of 00:26, 11 June 2014
, 10 years ago→{{header|Ruby}}: Switch from reading the DATA handle to reading a file.
(→{{header|Ruby}}: Switch from reading the DATA handle to reading a file.) |
|||
Line 544:
=={{header|Ruby}}==
{{works with|Ruby|1.9}}
<lang ruby>DATA.each_char{|c| p c}▼
<lang ruby>File.open('input.txt', 'r:utf-8') do |f|
end</lang>
or
<lang ruby>File.open('input.txt', 'r:utf-8') do |f|
while c = f.getc
p c
end
end</lang>
=={{header|Run BASIC}}==
|