method
putc
v1_9_2_180 -
Show latest stable
- Class:
StringIO
putc(p1)public
See IO#putc.
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;
} Related methods
- Instance methods
- <<
- binmode
- bytes
- chars
- close
- close_read
- close_write
- closed?
- closed_read?
- closed_write?
- codepoints
- each
- each_byte
- each_char
- each_codepoint
- each_line
- eof
- eof?
- external_encoding
- fcntl
- fileno
- flush
- fsync
- getbyte
- getc
- gets
- initialize_copy
- internal_encoding
- isatty
- length
- lineno
- lineno=
- lines
- pid
- pos
- pos=
- printf
- putc
- puts
- read
- read_nonblock
- readbyte
- readchar
- readline
- readlines
- readpartial
- reopen
- rewind
- seek
- set_encoding
- size
- string
- string=
- sync
- sync=
- sysread
- syswrite
- tell
- truncate
- tty?
- ungetbyte
- ungetc
- write
- write_nonblock
- Class methods
- new
- open