(***********************************************************************) (* *) (* OCaml library from the book ``Apprendre à programmer avec OCaml'' *) (* *) (* Sylvain Conchon and Jean-Christophe Filliâtre *) (* Université Paris Sud *) (* *) (* Copyright 2014 Université Paris Sud. All rights reserved. This *) (* file is distributed under the terms of the GNU Library General *) (* Public License, with the same special exception on linking as the *) (* OCaml library. See http://caml.inria.fr/ocaml/license.fr.html *) (* *) (***********************************************************************) (* Programme 7 page 54 Copie d'un fichier *) let copy_file f1 f2 = let c1 = open_in f1 in let c2 = open_out f2 in try while true do output_char c2 (input_char c1) done with End_of_file -> close_in c1; close_out c2 let () = copy_file Sys.argv.(1) Sys.argv.(2)