getc()
public
See <a href="/ruby/IO/getc">IO#getc</a>.
Show source
/*
* call-seq:
* strio.getc -> fixnum or nil
*
* See IO#getc.
*/
static VALUE
strio_getc(self)
VALUE self;
{
struct StringIO *ptr = readable(StringIO(self));
int c;
if (ptr->pos >= RSTRING(ptr->string)->len) {
ptr->flags |= STRIO_EOF;
return Qnil;
}
c = RSTRING(ptr->string)->ptr[ptr->pos++];
return CHR2FIX(c);
}