IO.Raw
wrappers for functions from the C standard library. Consider using a more carpesque function from IO when it exists. For detailed documentation please consult the documentation of your system (e.g. under Linux try man fprint).
fclose
(Fn [(Ptr FILE)] Int)
closes a file pointer (thin wrapper for the C standard library).
fflush
(Fn [(Ptr FILE)] Int)
flushes a file pointer, i.e. commits every write (thin wrapper for the C standard library).
fgetc
(Fn [(Ptr FILE)] Int)
gets a character from file (thin wrapper for fgetc from the C standard library).
fopen
(Fn [(Ref String a), (Ref String b)] (Ptr FILE))
(fopen pathname mode)
opens a file for input/output/appending (thin wrapper for the C standard library). Consider using the function IO.open-file instead.
fputc
(Fn [Int, (Ptr FILE)] Int)
writes a character to a file (thin wrapper for fputc from the C standard library).
fread
(Fn [(Ref String a), Int, Int, (Ptr FILE)] Int)
(fread file-name item-size items-count file)
reads from a file into C-String (thin wrapper for fread(cstr, item-size, items-count, file) from C standard library). Consider using read-file
or unsafe-read-file
instead.
fseek
(Fn [(Ptr FILE), Int, Int] Int)
sets the position indicator of a file (thin wrapper for fseek(file, offset, whence) from C standard library).
ftell
(Fn [(Ptr FILE)] Int)
gets the position indicator of a file (thin wrapper for the C standard library).
fwrite
(Fn [(Ref String a), Int, Int, (Ptr FILE)] Int)
(fwrite data item-size items-count file)
writes a C-string to a file and returns the number of written items (thin wrapper for the C standard library). Consider using write-file
instead.
fwrite!
(Fn [(Ref String a), Int, Int, (Ptr FILE)] ())
(fwrite! data item-size items-count file)
like fwrite but returns no indicator whether writing to file succeeded. Consider using fwrite instead.
get-char
(Fn [] Int)
gets a character from stdin (thin wrapper for getchar() from C standard library).
rewind
(Fn [(Ptr FILE)] ())
rewinds a file pointer, i.e. puts input and output stream to beginning (thin wrapper for the C standard library). If you want to verify, that this succeeded, use (fseek stream 0, SEEK_SET) instead.
unlink
(Fn [(Ref String a)] Int)
(unlink file-name)
unlinks a file, i.e. deletes it (thin wrapper for POSIX api in <unistd.h>).
unlink!
(Fn [(Ref String a)] ())
(unlink! file-name)
same as (unlink) but to be used as a side effect.