[comp.lang.pascal] Problems with Turbo I/O

89RBW%WILLIAMS.BITNET@WISCVM.WISC.EDU (04/24/87)

Turbo Pascal defaults to using CON: as the input/output device, but even if
using stdin/stdout, it's using a simple algorithm for distinguishing real
numbers in the input.  You tell it to expect a real, then two characters by
read(r,a,b);  The read procedure is presented with the sequence of bytes
corresponding to 1,2,.,3,4, ,E,T when you type 12.34 ET.  Using some fairly
standard parsing rules, read builds a real number using the numbers and the
decimal point.  When it runs into the blank, it knows that the real number is
done, time to move on.  The next request is for a character, and the blank
fits nicely in there.  Then the E goes into variable b, and the T is saved for
future use.  When you typed 12.34ET, read was cruising along with the real
number, found the E and decided that you were entering a number in exponential
notation, then the next character was a T, which didn't fit the definition at
all, hence I/O error #10.  A simple solution is read(r,dummy,a,b) where
dummy is a char variable that you never use.