IO File library

August 19, 2024 ยท View on GitHub

Source: include/stdlib/io/file.ml

Provides a frontend for c file-related functions.

Functions

FunctionDescription
open_fileOpens a file identified by filename in the given file acces mode (mode defaults to read mode)
read_lineReads a line from the given stream until a newline or end-of-file is encountered.
read_fileReads size bytes from the file associated with the given stream and returns it in string form. (size defaults to file size)

Macro

MacroDescription
close_fileCloses the given file stream

Warnings

Warning

Failing to close the file stream returned by open_file will cause a dangling file pointer security issue.