[fpc-pascal]exception handling

kractor baron.kractor at cogeco.ca
Wed Mar 17 19:22:52 CET 2004


Michael Van Canneyt wrote:

>I have been able to reproduce this. However, I'm not sure what the cause
>it. My guess is that the end-of-line is not consumed before the
>exception is raised, and therefore the
>
>        readln(NewAlbum.alLabel);
>
>line gets an empty input line. Delphi does consume the end-of-line, and
>waits for the input of the label.
>
>This is a very tricky issue, I think the core FPC list needs to discuss
>it.
>
>For the moment, I would do like this;
>
>Var
>  A : String;
>
>begin
>         readln(A);
>         NewAlbum.Year:=StrToIntDef(A,0);
>         write('label: ');
>         readln(NewAlbum.alLabel);
>         write('tracks: ');
>         readln(NewAlbum.NumTracks);
>
>This avoids the exception.
>
if there's anyting anyone needs from me on this, feel free to let me 
know. since you've indicated that you've been able to reproduce the 
error i'll assume you won't need the code that I have. however, should 
that be needed i'd be more than happy to send it.




More information about the fpc-pascal mailing list