|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: SCANF() Behaves IncorrectlyInformation in this article applies to:
SYMPTOMSWhen I use scanf() in my program, I cannot enter any data. The function sometimes returns after entering one character and sometimes after two, but it never waits for Enter to be pressed, as it should. It always returns a value of zero and the variables passed to scanf() are never assigned values. CAUSEThis is a bug in version 5.5 of the C51 compiler. See below for more information. RESOLUTIONIf you wish to enter lines of text, then the Measure example program demonstrates how to do this by using the getkey() function. The code is self-contained and can be found in the getline.c source file. A similar method can be used to enter values, either parsing the input as it is entered or by entering a string and calling atoi() to convert to an integer. SEE ALSOLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.