In_channel collects all of the pervasive functions that work on in_channels.
It adds some new functions (like
It names things using the fact that there is no worry about toplevel name
conflicts (since we are in a module).
It uses labelled arguments.
It returns an option rather than raising End_of_file.
Channels are opened in binary mode iff
binary is true. This only has an effect on
with_file ~f fname executes
~f on the open channel from
fname, and closes it afterwards.
input_line ?fix_win_eol t reads a line from
t and returns it, without
the newline ("\n") character at the end, and, if
fix_win_eol the trailing
"\r\n" is dropped.
fold_lines ?fix_win_eol t ~init ~f folds over the lines read from
input_line. Lines are provided to
f in the order they are
found in the file.
Completely reads an input channel and returns the results as a list of strings. Each line in one string.
iter_lines ?fix_win_eol t ~f applies
f to each line read from
read_lines filename Opens filename, reads all lines, and closes the file.
read_all filename Opens filename, reads all input, and closes the file.