I have a quite simple issue I think, but no way to figure out what's going wrong. I want to open a file and try to failwith a custom message if the file don't exist or something else.
Here my code (sorry for french comment):
if (argc = 1) then
aide ()
else
(* Si plus d'un argument, on récupère le type *)
if argc >= 2 then
let stage = int_of_string (Sys.argv.(1)) in
if stage != 0 && stage != 1 then
aide ()
else
()
else
()
;
(* Si plus de deux arguments, on récupère aussi l'entrée *)
if argc >= 3 then
let filename = Sys.argv.(2) in
let input =
try
open_in filename
with _ -> failwith ("Impossible d'ouvrir le fichier " ^ filename)
else
()
;
;;
I've a syntax error on the with keyword. Someont have an idea ? Thanks.