/* * call-seq: * ios.sync = boolean => boolean * * Sets the ``sync mode'' to <code>true</code> or <code>false</code>. * When sync mode is true, all output is immediately flushed to the * underlying operating system and is not buffered internally. Returns * the new state. See also <code>IO#fsync</code>. * * f = File.new("testfile") * f.sync = true * * <em>(produces no output)</em> */ static VALUE rb_io_set_sync(io, mode) VALUE io, mode; { OpenFile *fptr; GetOpenFile(io, fptr); if (RTEST(mode)) { fptr->mode |= FMODE_SYNC; } else { fptr->mode &= ~FMODE_SYNC; } return mode; }