bytes()
public
Returns an enumerator that gives each byte
(0..255) in ios. The stream must be opened for reading or an
IOError will be raised.
f = File.new("testfile")
f.bytes.to_a
f.rewind
f.bytes.sort
Show source
/*
* call-seq:
* ios.bytes => anEnumerator
*
* Returns an enumerator that gives each byte (0..255) in <em>ios</em>.
* The stream must be opened for reading or an <code>IOError</code>
* will be raised.
*
* f = File.new("testfile")
* f.bytes.to_a #=> [104, 101, 108, 108, 111]
* f.rewind
* f.bytes.sort #=> [101, 104, 108, 108, 111]
*/
static VALUE
rb_io_bytes(io)
VALUE io;
{
return rb_enumeratorize(io, ID2SYM(rb_intern("each_byte")), 0, 0);
}