| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.14.10.2 Port Manipulation
The procedures listed below operate on any kind of R6RS I/O port.
- Scheme Procedure: port-position port
If port supports it (see below), return the offset (an integer) indicating where the next octet will be read from/written to in port. If port does not support this operation, an error condition is raised.
This is similar to Guile’s
seekprocedure with theSEEK_CURargument (see section Random Access).
- Scheme Procedure: set-port-position! port offset
If port supports it (see below), set the position where the next octet will be read from/written to port to offset (an integer). If port does not support this operation, an error condition is raised.
This is similar to Guile’s
seekprocedure with theSEEK_SETargument (see section Random Access).
- Scheme Procedure: call-with-port port proc
Call proc, passing it port and closing port upon exit of proc. Return the return values of proc.
- Scheme Procedure: binary-port? port
Return
#tif port is a binary port, suitable for binary data input/output.Note that internally Guile does not differentiate between binary and textual ports, unlike the R6RS. Thus, this procedure returns true when port does not have an associated encoding—i.e., when
(port-encoding port)is#f(see section port-encoding). This is the case for ports returned by R6RS procedures such asopen-bytevector-input-portandmake-custom-binary-output-port.However, Guile currently does not prevent use of textual I/O procedures such as
displayorread-charwith binary ports. Doing so “upgrades” the port from binary to textual, under the ISO-8859-1 encoding. Likewise, Guile does not prevent use ofset-port-encoding!on a binary port, which also turns it into a “textual” port.
- Scheme Procedure: textual-port? port
Always return #t, as all ports can be used for textual I/O in Guile.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
