community.borland.com

Article #15715: READ - SKIPPING OVER A READLN OR READ

 Technical Notes Database

TN715D.txt   READ - SKIPPING OVER A READLN OR READ
Category   :Pascal
Platform    :All
Product    :Turbo Pascal  2.0+

Description:
Q.  Why is my program not waiting for input on a Read or Readln?
A.  The program has a Read statement.  When the user enters
   information and hits a carriage return the information and the
   carriage return are stored in the keyboard buffer.  The Read
   statement reads everything until the carriage return, but not
   the carriage return.  When the program executes the next Read
   or Readln it will see the carriage return in the keyboard
   buffer.  It will then process the return and continue with the
   next instruction.  To the user it will appear that the program
   has skipped over the Read or Readln. To fix this problem never
   use Read to read information from the keyboard, always use
   Readln.


Reference:


7/16/98 4:35:35 PM
 

Last Modified: 01-SEP-99