sigildocs

(scheme file)

(scheme file) - R7RS File Library

File input/output operations for opening, reading, and writing files.

See: R7RS Small §6.13.1

For extended filesystem operations (directories, globs, metadata), use (sigil fs) instead.

Exports

Call a procedure with an input port, ensuring cleanup.

Opens the file, passes the port to proc, closes the port, and returns proc's result. The port is closed even if proc raises an error.

(call-with-input-file "data.txt"
  (lambda (port)
    (read-line port)))

Re-exported from (sigil io)

Call a procedure with an output port, ensuring cleanup.

Opens the file, passes the port to proc, closes the port, and returns proc's result.

(call-with-output-file "output.txt"
  (lambda (port)
    (write-string "Hello!" port)))

Re-exported from (sigil io)

Execute a thunk with a file as input.

Opens the file and executes the thunk. Currently a simplified version that doesn't rebind current-input-port.

Re-exported from (sigil io)

Execute a thunk with output going to a file.

Opens the file and executes the thunk. Currently a simplified version that doesn't rebind current-output-port.

Re-exported from (sigil io)

Open file for reading

Re-exported from (sigil io)

Open file for writing

Re-exported from (sigil io)

Open binary file for reading

Re-exported from (sigil io)

Open binary file for writing

Re-exported from (sigil io)