home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,078 of 2,978   
   Jyrki Lahtonen to Ruud Baltissen   
   Re: Runtime error 205   
   28 Oct 04 12:23:22   
   
   From: lahtonen@utu.fi   
      
   Ruud Baltissen wrote:   
      
   > begin   
   >   str := '1.234567898765E40';   
   >   {$I-} val(str, r, i); {$I+}   
   >   writeln(r);   
   > end.   
   >   
   > The above causes error 205. But what I want is to be able to handle   
   > the error myself. The {$I-} doesn't help. What directive should I use   
   > instead? Or something else?   
      
   Hi Ruud,   
      
   When using the "val"-procedure, the last parameter is used as the control   
   variable. If zero, then "val" worked out right, so do it as follows:   
      
    > begin   
    >   str := '1.234567898765E40';   
    >   {$I-} val(str, r, i); {$I+}   
       if i=0 then writeln(r)   
       else writeln('Input error');   
    > end.   
      
   The BP on-line help available within the IDE also explains this.   
   Similarly when trapping I/O errors, using the directive is not   
   enough. You also need to check the value of the control variable   
   "IOResult", and go from there. Check the on-line help for details.   
      
   Cheers,   
      
   Jyrki Lahtonen, Turku, Finland   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca