Module (scheme file)
[procedure] (call-with-input-file string proc)[procedure] (call-with-output-file string proc)
It is an error if proc does not accept one argument.
These procedures obtain a textual port obtained by opening the named file for input or output as if by open-input-file or open-output-file. The port and proc are then passed to a procedure equivalent to call-with-port.
[procedure] (with-input-from-file string thunk)[procedure] (with-output-to-file string thunk)
The file is opened for input or output as if by open-input-file or open-output-file, and the new port is made to be the value returned by current-input-port or current-output-port (as used by (read), (write obj), and so forth). The thunk is then called with no arguments. When the thunk returns, the port is closed and the previous default is restored. It is an error if thunk does not accept zero arguments. Both procedures return the values yielded by thunk. If an escape procedure is used to escape from the continuation of these procedures, they behave exactly as if the current input or output port had been bound dynamically with parameterize.
[procedure] (open-input-file string)[procedure] (open-binary-input-file string)
Takes a string for an existing file and returns a textual input port or binary input port that is capable of delivering data from the file. If the file does not exist or cannot be opened, an error that satisfies file-error? is signaled.
[procedure] (open-output-file string)[procedure] (open-binary-output-file string)
Takes a string naming an output file to be created and returns a textual output port or binary output port that is capable of writing data to a new file by that name. If a file with the given name already exists, the effect is unspecified. If the file cannot be opened, an error that satisfies file-error? is signaled.
[procedure] (file-exists? filename)It is an error if filename is not a string.
The file-exists? procedure returns #t if the named file exists at the time the procedure is called, and #f otherwise.
[procedure] (delete-file filename)It is an error if filename is not a string.
The delete-file procedure deletes the named file if it exists and can be deleted, and returns an unspecified value. If the file does not exist or cannot be deleted, an error that satisfies file-error? is signaled.
Previous: Module (scheme complex)
Next: [[Module (scheme
eval)]]