| ARM Technical Support Knowledge Articles | |
Applies to: C51 C Compiler
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.
Article last edited on: 2004-06-08 10:50:50
Did you find this article helpful? Yes No
How can we improve this article?