static VALUE
strio_putc(VALUE self, VALUE ch)
{
    struct StringIO *ptr = writable(StringIO(self));
    int c = NUM2CHR(ch);
    long olen;
    check_modifiable(ptr);
    olen = RSTRING_LEN(ptr->string);
    if (ptr->flags & FMODE_APPEND) {
        ptr->pos = olen;
    }
    strio_extend(ptr, ptr->pos, 1);
    RSTRING_PTR(ptr->string)[ptr->pos++] = c;
    OBJ_INFECT(ptr->string, self);
    return ch;
}