Created
September 14, 2017 09:36
-
-
Save longyue0521/d06811d3b90cb56764cd3771b56777d0 to your computer and use it in GitHub Desktop.
clear standard input buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void clear_stdin_buffer() { | |
| char ch; | |
| while( (ch = getchar()) != '\n' && ch != EOF ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment