(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-with-input-fileprocedureCall 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-with-output-fileprocedureCall 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)
with-input-from-fileprocedureExecute 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)
with-output-to-fileprocedureExecute 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-input-fileprocedureOpen file for reading
Re-exported from (sigil io)
open-output-fileprocedureOpen file for writing
Re-exported from (sigil io)
open-binary-input-fileprocedureOpen binary file for reading
Re-exported from (sigil io)
open-binary-output-fileprocedureOpen binary file for writing
Re-exported from (sigil io)