Input and output

Access to file-like objects is faciliated by using so called ports. Core library supports on disk files and in-memory buffers, C extensions can implement another types of ports. Extensions bundled with dfsch allow you to additionally access:

Port for accessing on disk files can be opened by open-file-port, such port should be closed by close-file-port! once it is not needed anymore, althought it will be closed automatically by garbage collector.

Function string-input-port produces read-only port containing supplied string and string-output-port produces write-only port that collects data written to it into string (accessed by string-output-port-value). Function null-port returns port that reads as empty and cannot be written into.

Global constants *standard-input-port*, *standard-output-port* and *standard-error-port* represent respective streams provided by operating system. Most functions operating on ports do not require explicit port argument and can use implicit ports which can be examined by current-input-port and current-output-port and changed by set-current-input-port! and set-current-output-port! (current-error-port is also supported for completenes, but not used by any functions in core library).

Ports can be accessed on line/byte level by following functions:

Also, objects can be written in human readable format and read back.


In addition to file-based IO facilities, dfsch's core library provides support for serialization of almost arbitrary object graphs into portable and hopefuly compact binary format.

Functions serialize and deserialize provide high level access to serialization mechanism and convert objects into byte-vectors and vice versa. Following functions offer more control over serialization:

And deserialization:

Generated by docgen.scm running on dfsch 0.4.0 (bp-0.4.0-18-g88df03b) on 2012-04-16 10:00:28