public Method

IO.flush

ios.flush     ios

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

Source Code

/*
*  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;
{
   OpenFile *fptr;
   FILE *f;

   GetOpenFile(io, fptr);
   rb_io_check_writable(fptr);
   f = GetWriteFile(fptr);

   io_fflush(f, fptr);

   return io;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.