tur/io
stdlib/io.tur
defn
file-size
(file-size [f])
return the byte size of an already-open file.
Parameters
| f | a FILE* cast to int64_t (as returned by fopen). |
Example
The file size in bytes as an int. (file-size my-file-ptr) ; => 1024
defn
Real-FileSystem
(Real-FileSystem)
create a FileSystem capability backed by libc.
Since: Phase 16
defn
Real-FileSystem-free
(Real-FileSystem-free [fs])
release a FileSystem capability created by Real-FileSystem.
Parameters
| fs | the FileSystem pointer returned by Real-FileSystem. |
Since: Phase 16
defn
read-file
(read-file [path])
read an entire file into a newly allocated buffer.
Parameters
| path | the filesystem path to open (:cstr). |
Since: Phase 16
defn
write-file
(write-file [path data len])
write a byte buffer to a file, overwriting any existing content.
Parameters
| path | the destination filesystem path (:cstr). | |
| data | pointer to the data to write. | |
| len | number of bytes to write. |
Since: Phase 16
defn
file-exists?
(file-exists? [path])
test whether a file is accessible for reading.
Parameters
| path | the filesystem path to check (:cstr). |
Since: Phase 16
defn
list-dir
(list-dir [path])
list all non-hidden entries in a directory.
Parameters
| path | the directory path to list (:cstr). |
Since: Phase 16
defn
free-dir-listing
(free-dir-listing [entries])
free a directory listing returned by list-dir.
Parameters
| entries | the NULL-terminated string array returned by list-dir. |
Since: Phase 16