Re: small code problem

From: Fabrice Le Fessant (fessant@pa.dec.com)
Date: Fri Jul 09 1999 - 03:37:12 MET DST


From: Fabrice Le Fessant <fessant@pa.dec.com>
Date: Thu, 8 Jul 1999 18:37:12 -0700 (PDT)
To: knotwell@f5.com
Subject: Re: small code problem

> 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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET