File: buffer.ml

package info (click to toggle)
ocaml-res 2.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 280 kB
  • ctags: 689
  • sloc: ml: 1,226; makefile: 86
file content (9 lines) | stat: -rw-r--r-- 344 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
(* Reads a file given as first argument into a buffer and prints it
   out again. Uses an exponentially growing read-ahead during reading
   (just for demonstration). *)

let _ =
  let buf = Res.Buffer.empty ()
  and file = open_in Sys.argv.(1) in
  Res.Buffer.add_full_channel_f buf file 50000 (( * ) 2);
  Res.Buffer.output_buffer stdout buf