Next: , Previous: , Up: R6RS I/O Ports   [Contents][Index]


6.15.10.7 Input Ports

Scheme Procedure: input-port? obj

Returns #t if the argument is an input port (or a combined input and output port), and returns #f otherwise.

Scheme Procedure: port-eof? input-port

Returns #t if the lookahead-u8 procedure (if input-port is a binary port) or the lookahead-char procedure (if input-port is a textual port) would return the end-of-file object, and #f otherwise. The operation may block indefinitely if no data is available but the port cannot be determined to be at end of file.

Scheme Procedure: open-file-input-port filename
Scheme Procedure: open-file-input-port filename file-options
Scheme Procedure: open-file-input-port filename file-options buffer-mode
Scheme Procedure: open-file-input-port filename file-options buffer-mode maybe-transcoder

maybe-transcoder must be either a transcoder or #f.

The open-file-input-port procedure returns an input port for the named file. The file-options and maybe-transcoder arguments are optional.

The file-options argument, which may determine various aspects of the returned port (see R6RS File Options), defaults to the value of (file-options).

The buffer-mode argument, if supplied, must be one of the symbols that name a buffer mode. The buffer-mode argument defaults to block.

If maybe-transcoder is a transcoder, it becomes the transcoder associated with the returned port.

If maybe-transcoder is #f or absent, the port will be a binary port and will support the port-position and set-port-position! operations. Otherwise the port will be a textual port, and whether it supports the port-position and set-port-position! operations is implementation-dependent (and possibly transcoder-dependent).

Scheme Procedure: standard-input-port

Returns a fresh binary input port connected to standard input. Whether the port supports the port-position and set-port-position! operations is implementation-dependent.

Scheme Procedure: current-input-port

This returns a default textual port for input. Normally, this default port is associated with standard input, but can be dynamically re-assigned using the with-input-from-file procedure from the io simple (6) library (see rnrs io simple). The port may or may not have an associated transcoder; if it does, the transcoder is implementation-dependent.


Next: , Previous: , Up: R6RS I/O Ports   [Contents][Index]