C51: SCANF() BEHAVES INCORRECTLY
Information in this article applies to:
When 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.
This is a bug in version 5.5 of the C51 compiler. See below for more information.
If you wish to enter lines of text, then the Measure example program demontrates 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.
Last Reviewed: Tuesday, June 8, 2004
of your data.