[fpc-pascal]exception handling

kractor baron.kractor at cogeco.ca
Sun Mar 21 16:15:36 CET 2004


Jonas Maebe wrote:

> The problem is simply that "readln" is split into "read" and 
> "readline_end". The former reads whatever you want to read, the latter 
> consumes the end-of-line. The ioresult is checked after both 
> operations. If the read already returned an error, then an exception 
> will be raised, so the readln_end is never executed.
>
> That's the way readln (and writeln) was implemented from the start in 
> FPC. I don't know if there's an elegant solution possible, or that it 
> requires to change the whole way we handle it (e.g. passing a boolean 
> to each internal read routine that notes whether or not it should 
> consume everything till the end of the current line, no matter what 
> happens).

ok, thanks for clarifying that for me. it shouldn't be too difficult to 
find a workaround, in fact the code i'm using atm will do quite nicely  
since if its "triggered" the value is set to 0 and that's certainly 
something i can test for.

again, thanks ... :D




More information about the fpc-pascal mailing list