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