put-u8, write-u8 - write a byte to a binary output port
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
(import (scheme base)) ;R7RS
(put-u8 binary-output-port byte) ;R6RS
(write-u8 byte) ;R7RS
(write-u8 byte binary-output-port) ;R7RS
to the given
- Chibi Scheme
at program start is both textual and binary.
It should normally not be possible to use
on the current output port before rebinding it to a binary output
port (which is not possible in R6RS).
Returns unspecified values.
Returns a unspecified value.
;; R7RS code to create a file with the single line "A"
(call-with-port (open-output-file "test.txt")
(write-u8 65 p)
(write-u8 10 p)))
Commonly used in applications that create binary files or other binary data.
There is often a mix of single bytes intermixed with larger writes with
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.
must be an exact integer between 0 and 255.
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.
procedure is new to the reworked I/O system introduced with R6RS.
procedure is new in R7RS and is similar to
but works with binary output ports, which did not exist in R5RS.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.