method
getc
ruby latest stable - Class:
StringIO
getc()public
See IO#getc.
static VALUE
strio_getc(VALUE self)
{
struct StringIO *ptr = readable(self);
rb_encoding *enc = get_enc(ptr);
VALUE str = ptr->string;
long pos = ptr->pos;
int len;
char *p;
if (pos >= RSTRING_LEN(str)) {
return Qnil;
}
p = RSTRING_PTR(str)+pos;
len = rb_enc_mbclen(p, RSTRING_END(str), enc);
ptr->pos += len;
return enc_subseq(str, pos, len, enc);
} 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=
- putc
- read
- readlines
- reopen
- rewind
- seek
- set_encoding
- size
- string
- string=
- sync
- sync=
- tell
- truncate
- tty?
- ungetbyte
- ungetc
- write
- Class methods
- new
- open