textual-port?, binary-port? - test if ports are textual or binary

LIBRARY

(import (rnrs))                     ;R6RS
(import (rnrs io ports))            ;R6RS
(import (scheme base))              ;R7RS

SYNOPSIS

(binary-port? port)
(textual-port? port)

DESCRIPTION

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.

RETURN VALUES

Returns a single boolean object.

EXAMPLES

(call-with-input-file "/dev/null" textual-port?)
   => #t

(binary-port? (open-bytevector-input-port #vu8(1 2 3)))
   => #t

COMPATIBILITY

Some R7RS implementations may allow both binary and textual operations on ports.

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.
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.

SEE ALSO

input-port?(3scm).

STANDARDS

R6RS, R7RS

HISTORY

New in R6RS and new in R7RS. In R5RS and earlier reports, ports were conceptually textual.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.