I am not able to flush stdin

后端 未结 7 1920
孤城傲影
孤城傲影 2020-11-22 14:51

How to flush the stdin??

Why is it not working in the following code snippet?

#include 
#include 
#i         


        
7条回答
  •  悲&欢浪女
    2020-11-22 14:59

    int c;
    while((c = getchar()) != '\n' && c != EOF);
    

    Is how I'd clear the input buffer.

提交回复
热议问题