textual-port?, binary-port? - test if ports are textual or binary
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
(import (scheme base)) ;R7RS
(binary-port? port)
(textual-port? port)
The textual-port? procedure returns #t if port is textual,
and returns #f otherwise. The binary-port? procedure returns
#t if port is binary, and returns #f otherwise.
- R7RS
- These procedures accept any kind of object.
Returns a single boolean object.
(call-with-input-file "/dev/null" textual-port?)
=> #t
(binary-port? (open-bytevector-input-port #vu8(1 2 3)))
=> #t
Some R7RS implementations may allow both binary and textual operations on ports.
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.
- R7RS
- Passing the wrong number of arguments is an error. Implementations may
signal an error, extend the procedure's domain of definition to include
such arguments, or fail catastrophically.
New in R6RS and new in R7RS. In R5RS and earlier reports, ports were
conceptually textual.