| flush-output-port(3scm) | Scheme Programmer's Manual | flush-output-port(3scm) |
NAME
flush-output-port - flush buffered data from a port to its sink
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs io ports)) ;R6RS (import (scheme base)) ;R7RS
SYNOPSIS
(flush-output-port) ;R7RS (flush-output-port output-port)
DESCRIPTION
Flushes any buffered output from the buffer of output-port to the underlying file, device, or object.
IMPLEMENTATION NOTES
- Vicare Scheme
- The standard output port is block buffered and it is not closed on exit. A manual flush is needed before exiting the program.
RETURN VALUES
EXAMPLES
(display "Enter your name: ") (flush-output-port (current-output-port)) (define name (get-line (current-input-port)))
APPLICATION USAGE
Used to manually flush a port's internal buffers. The port is automatically flushed when the port is closed, so there is no need for a manual flush before closing a port.
RATIONALE
Output ports are line buffered, block buffered or unbuffered. Buffering is typically good for performance, but sometimes applications need to write data immediately.
COMPATIBILITY
In R7RS, if output-port is omitted, it defaults to the value returned by current-output-port(3scm).
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its domain.
- &i/o-encoding (R6RS)
- The port's transcoder is in raise mode and it encountered a character that could not be translated into bytes. The untranslated character can be retrieved with i/o-encoding-error-char(3scm).
- &i/o-write (R6RS)
- There was an I/O error during the write operation.
- &i/o-port (R6RS)
- This condition specifies the port object related to the &i/o-write condition.
- R7RS
- The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
SEE ALSO
call-with-port(3scm), close-port(3scm)
STANDARDS
R6RS, R7RS
HISTORY
This procedure first appeared in R6RS as part of the reworked I/O system.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2023-07-24 |