13.3 Byte and String Output
procedure
(write-char char [out]) → void?
char : char? out : output-port? = (current-output-port)
procedure
(write-byte byte [out]) → void?
byte : byte? out : output-port? = (current-output-port)
procedure
out : output-port? = (current-output-port)
procedure
(write-string str [out start-pos end-pos])
→ exact-nonnegative-integer? str : string? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (string-length str)
The result is the number of characters written to out, which is always (- end-pos start-pos).
If str is mutable, mutations after write-string returns do not affect the characters written to out. (This independence from mutation is not a special property of write-string, but instead generally true of output functions.)
procedure
(write-bytes bstr [out start-pos end-pos])
→ exact-nonnegative-integer? bstr : bytes? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (bytes-length bstr)
procedure
(write-bytes-avail bstr [ out start-pos end-pos]) → exact-nonnegative-integer? bstr : bytes? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (bytes-length bstr)
The write-bytes-avail procedure never drops bytes; if write-bytes-avail successfully writes some bytes and then encounters an error, it suppresses the error and returns the number of written bytes. (The error will be triggered by future writes.) If an error is encountered before any bytes have been written, an exception is raised.
procedure
(write-bytes-avail* bstr [ out start-pos end-pos]) → (or/c exact-nonnegative-integer? #f) bstr : bytes? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (bytes-length bstr)
procedure
(write-bytes-avail/enable-break bstr [ out start-pos end-pos]) → exact-nonnegative-integer? bstr : bytes? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (bytes-length bstr)
procedure
(write-special v [out]) → boolean?
v : any/c out : output-port? = (current-output-port)
procedure
(write-special-avail* v [out]) → boolean?
v : any/c out : output-port? = (current-output-port)
procedure
(write-bytes-avail-evt bstr [ out start-pos end-pos]) → evt? bstr : bytes? out : output-port? = (current-output-port) start-pos : exact-nonnegative-integer? = 0 end-pos : exact-nonnegative-integer? = (bytes-length bstr)
Synchronizing on the object starts a write from bstr, and the event becomes ready when bytes are written (unbuffered) to the port. If start-pos and end-pos are the same, then the synchronization result is 0 when the port’s internal buffer (if any) is flushed, otherwise the result is a positive exact integer. If the event is not selected in a synchronization, then no bytes will have been written to out.
procedure
(write-special-evt v [out]) → evt?
v : any/c out : output-port? = (current-output-port)
Synchronizing on the object starts a write of the special value, and the event becomes ready when the value is written (unbuffered) to the port. If the event is not selected in a synchronization, then no value will have been written to out.
procedure
(port-writes-atomic? out) → boolean?
out : output-port?
procedure
(port-writes-special? out) → boolean?
out : output-port?