-
Notifications
You must be signed in to change notification settings - Fork 4
InputAndOutput
See Sockets.
(import (foment base)) to use these procedures.
procedure: (make-buffered-port binary-port)
Make a buffered binary port from binary-port; if binary-port is already buffered, then it is returned. If the binary-port is an input port, then the new buffered binary port will be an input port. Likewise, if the binary-port is an output port or an input and output port then the new textual port will be the same.
procedure: (make-encoded-port binary_port)
Automatically detect the encoding of binary_port and make a textual port which reads and/or writes characters in the correct encoding to the binary_port.
The UTF-16 byte order mark is automatically detected. Otherwise, the string coding:
is
searched for in the first 1024 bytes of the binary_port. Following coding:
should
be the name of a character encoding. Currently, ascii
, utf-8
, latin-1
, and iso-8859-1
are supported. If the encoding can not be automatically determined, ascii
is used.
procedure: (file-encoding)
procedure: (file-encoding proc)
procedure: (proc binary-port)
file-encoding
is a parameter. proc is called by open-input-file
and
open-output-file
to return a textual port appropriate for the encoding of a binary port.
The following example will open a file encoded using UTF-16.
(parameterize ((file-encoding make-utf8-port))
(open-input-file "textfile.utf8"))
procedure: (want-identifiers port flag)
Textual input ports can read symbols or identifiers. Identifiers contain location information
which improve error messages and stack traces. If flag is #f
then symbols will be
read from port by read. Otherwise, identifiers will be read.
procedure: (port-has-port-position? port)
Returns #t
if port supports the port-position
operation.
procedure: (port-position port)
Returns the position of the next read or write operation on port as a non-negative exact integer.
procedure: (port-has-set-port-position!? port)
Returns #t
if port supports the set-port-position!
operation.
procedure: (set-port-position! port position) procedure: (set-port-position! port position whence)
Sets the position of the next read or write operation on port. The
position must be an exact integer taken as relative to whence which may
be begin
, current
, or end
. If whence is not specified, then begin
is used.
(import (foment base))
to use these procedures.
procedure: (console-port? obj)
Return #t
is obj is a console port and #f
otherwise.
procedure: (set-console-input-editline! port flag)
port must be a console inport port. flag must be #t
or #f
. Turn on or off
editline mode for port.
procedure: (set-console-input-echo! port flag)
port must be a console inport port. flag must be #t
or #f
. Turn on or
off echo mode for port.