August 8th, 2003, 06:55 PM
problem with _getch preceding scanf
I am having a problem with _getch() preceding scanf() in Microsoft Visual C 6.0. When the scanf() is encountered it displays the character that was entered during the preceding _getch(). You can backspace over the displayed character and then enter whatever you wanted scanf() to read. Scanf() will then work correctly, but it is a nuisance. Does anyone have any suggestions as to how to deal with this? It seems that _getch() and scanf() must be sharing a buffer which doesn't get reset when scanf() starts.