strings_of_file : string -> string list
- SYNOPSIS
-
Read file and convert content into a list of strings.
- DESCRIPTION
-
When given a filename, the function strings_of_file attempts to open the file
for input, and if this is successful reads and closes it, returning a list of
strings corresponding to the lines in the file.
- FAILURE CONDITIONS
-
Fails if the file cannot be opened (e.g. it does not exist, or the permissions
are wrong).
- EXAMPLE
-
If the file /tmp/greeting contains the text
Hello world
Goodbye world
then
# strings_of_file "/tmp/greeting";;
val it : string list = ["Hello world"; "Goodbye world"]
- SEE ALSO
-
file_of_string, string_of_file.