tom_at_work at gmx.at
Wed Mar 17 13:28:36 CET 2004
> > spent a few moments going over the docs in the manual re: exception
> > handling. for some reason it just doesn't seem to be sinking in, as
> > nothing i've tried as of yet has managed to stop prog from crashing when
> > data in input that's of a different type than program is expecting
> > (string as opposed to integer, for example).
> - did you include the sysutils unit?
> - afaik readln just raises runtime error which is unspecified according to
> the docs; eventually an EIOError (or similar if this does not exist)
> this behaviour can be turned on/off with $I+/-.
> But to be sure, you might want to catch general exceptions.
> - do the following:
> s: String;
> i : Integer;
> code : Word;
> i := StrToInt(s);
> on EIOError ...
Obviously it should mean "on EConvertError..." here because StrToInt raises
an EConvertError when the string does not represent a valid integer.... (see
Not an EIOError, this one probably slipped in because I was talking about
catching an I/O Error in the other variants...
More information about the fpc-pascal