this's the second time you say) but problem is wider . imagine that in the moment we call
mainmenu()
(wich contain
printf("\n%s",mtext );
) we have in the stdin line ..mmmm...like this =
"dgfhj3 \n"
- it's useless data - we need to remove it from stdin , so we can call while
(getchar() != '\n');
for examp. and remove it - we'll have std in clear - and the first symbol (visible one , because the
\n - will be removed during other mainmenu iteration - or other cleaning - it's not our problem = we only need to correctly get the first symbol from the input line) will be read correctly ,
BUT
if we have stdin in clear standing at that moment we call
mainmenu()
- we'll have our program is stoped by technical (
not related to user interface) reading - it isn't good - so there should be way to avoid this stopping by checking the stdin stream (it may be empty).
how to check ?