Skip to content
instance method

IO#readbyte

() -> ::Integer
readbyte → integer

Reads and returns the next byte (in range 0..255) from the stream; raises EOFError if already at end-of-stream. See Byte IO.

Example
f = File.open('t.txt')
f.readbyte # => 70
f.close
f = File.open('t.rus')
f.readbyte # => 209
f.close

Related: IO#getbyte (will not raise EOFError).

See also #read #readchar #raw! #readline also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0