package gen

  1. Overview
  2. Docs
val with_in : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (char t -> 'a) -> 'a

read filename f opens filename and calls f g, where g is a clonable generator of characters from the file. It can be cloned by calling g#save (which saves the position in the file), and used with g#next. Distinct clones of g shouldn't be used at the same time (otherwise Failure _ will be raised). Both the generator and save points are only valid within the scope in which f is called.

OCaml

Innovation. Community. Security.