method
getc
v1_8_7_72 -
Show latest stable
- Class:
StringIO
getc()public
See IO#getc.
/*
* call-seq:
* strio.getc -> fixnum or nil
*
* See IO#getc.
*/
static VALUE
strio_getc(self)
VALUE self;
{
struct StringIO *ptr = readable(StringIO(self));
int c;
if (ptr->pos >= RSTRING(ptr->string)->len) {
ptr->flags |= STRIO_EOF;
return Qnil;
}
c = RSTRING(ptr->string)->ptr[ptr->pos++];
return CHR2FIX(c);
} 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
- eof?
- eof?
- fcntl
- fileno
- flush
- fsync
- getbyte
- getc
- gets
- initialize_copy
- isatty
- length
- lineno
- lineno=
- lines
- path
- pid
- pos
- pos
- pos=
- printf
- putc
- puts
- read
- readbyte
- readchar
- readline
- readline
- readlines
- reopen
- rewind
- rewind
- seek
- seek
- size
- string
- string=
- sync
- sync=
- sysread
- syswrite
- tell
- truncate
- tty?
- ungetc
- write
- Class methods
- new
- new
- open