static VALUE
strio_getc(VALUE self)
{
struct StringIO *ptr = readable(StringIO(self));
rb_encoding *enc = rb_enc_get(ptr->string);
int len;
char *p;
if (ptr->pos >= RSTRING_LEN(ptr->string)) {
return Qnil;
}
p = RSTRING_PTR(ptr->string)+ptr->pos;
len = rb_enc_mbclen(p, RSTRING_END(ptr->string), enc);
ptr->pos += len;
return rb_enc_str_new(p, len, rb_enc_get(ptr->string));
}