From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA18957 for caml-redistribution; Sat, 10 Jul 1999 20:03:27 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA32582 for ; Fri, 9 Jul 1999 03:37:54 +0200 (MET DST) Received: from mail1.digital.com (mail1.digital.com [204.123.2.50]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id DAA05268 for ; Fri, 9 Jul 1999 03:37:53 +0200 (MET DST) Received: from src-mail.pa.dec.com (src-mail.pa.dec.com [16.4.16.35]) by mail1.digital.com (8.9.2/8.9.2/WV2.0g) with ESMTP id SAA18948; Thu, 8 Jul 1999 18:37:50 -0700 (PDT) Received: by src-mail.pa.dec.com; id SAA25408; Thu, 8 Jul 1999 18:37:19 -0700 (PDT) Received: (from lefessan@localhost) by langouste.pa.dec.com (8.9.3/8.9.3) id SAA08827; Thu, 8 Jul 1999 18:37:17 -0700 From: Fabrice Le Fessant Message-ID: <14213.21064.503662.843704@langouste.pa.dec.com> Date: Thu, 8 Jul 1999 18:37:12 -0700 (PDT) To: knotwell@f5.com Cc: Gerd.Stolpmann@darmstadt.netsurf.de, caml-list@inria.fr Subject: Re: small code problem References: <14205.15754.427409.474325@knotwell.f5.com> <99070901192505.28040@schneemann> <14213.16897.231203.976296@knotwell.f5.com> X-Mailer: VM 6.62 under Emacs 19.34.1 Reply-To: fessant@pa.dec.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 Sender: weis > This is a serious question (not an argumentative one). How do I avoid > Invalid_argument when I'm expecting the user to enter a filename on > the command-line? Or are you just talking in general? You can check the size of the array before reading it: if Array.length Sys.argv < 2 then usage ();; let filename = Sys.argv.(1) will never raise an Invalid_argument exception. - Fabrice Homepage: http://pauillac.inria.fr/~lefessan