The information in this article applies to:
SUMMARYWhen a function of the scanf() family reads a white-space character--blank (' '), tab ('\t'), or newline ('\n')--it does not ordinarily store that character into the location provided by the argument pointer. However, as documented in the Microsoft C Run-Time Library Reference, if the %c type field format specifier is used, the scanf() functions will store a white- space character. This behavior can cause unexpected results. MORE INFORMATION
After the first character is read in the sample code below, the following
white-space character that is still in the internal buffer for stdin is
read and stored by the second scanf(). This effectively causes the second
prompt to be skipped (the message is printed, but the program does not wait
to accept a character).
Sample Code
Additional query words:
Keywords : kbcode kbCRT kbVC100 kbVC150 kbVC200 kbVC210 kbVC400 kbVC500 kbVC600 |
Last Reviewed: July 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |