/* * call-seq: * strio.putc(obj) -> obj * * See IO#putc. */ static VALUE strio_putc(self, ch) VALUE self, ch; { struct StringIO *ptr = writable(StringIO(self)); int c = NUM2CHR(ch); long olen; check_modifiable(ptr); olen = RSTRING(ptr->string)->len; if (ptr->flags & FMODE_APPEND) { ptr->pos = olen; } strio_extend(ptr, ptr->pos, 1); RSTRING(ptr->string)->ptr[ptr->pos++] = c; OBJ_INFECT(ptr->string, self); return ch; }