flush()
public
Flushes any buffered data within ios to the underlying operating
system (note that this is Ruby internal buffering only; the OS may buffer
the data as well).
$stdout.print "no newline"
$stdout.flush
produces:
no newline
Show source
/*
* call-seq:
* ios.flush => ios
*
* Flushes any buffered data within <em>ios</em> to the underlying
* operating system (note that this is Ruby internal buffering only;
* the OS may buffer the data as well).
*
* $stdout.print "no newline"
* $stdout.flush
*
* <em>produces:</em>
*
* no newline
*/
static VALUE
rb_io_flush(io)
VALUE io;
{
rb_io_t *fptr;
FILE *f;
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
f = GetWriteFile(fptr);
io_fflush(f, fptr);
fsync(fileno(f));
return io;
}