Module Gen.IO
val with_in : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (char t -> 'a) -> 'awith_in filename fopensfilenameand callsf g, wheregis a generator of characters from the file. The generator is only valid within the scope in whichfis called.
val with_lines : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (string t -> 'a) -> 'awith_lines filename fopens filefilenameand callsf g, wheregis a generator that iterates on the lines from the file. Do not use the generator outside of the scope off- since
- 0.4
val write_str : ?mode:int -> ?flags:Stdlib.open_flag list -> ?sep:string -> string -> string t -> unitwrite_to filename gwrites all strings fromginto the given file. It takes care of opening and closing the file. Does not addsepafter the last string.- parameter mode
default
0o644
- parameter flags
used by
open_out_gen. Default:[Open_creat;Open_wronly].
- parameter sep
separator between each string (e.g. newline)
val write : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> char t -> unitSame as
write_strbut with individual characters
val write_lines : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string t -> unitwrite_lines file gis similar towrite_str file g ~sep:"\n"but also adds'\n'at the end of the file- since
- 0.4