clears stdin up until newline */
| 23 | |
| 24 | /* clears stdin up until newline */ |
| 25 | void clear_stdin(void) |
| 26 | { |
| 27 | char x = 0; |
| 28 | while(1) |
| 29 | { |
| 30 | x = getchar(); |
| 31 | if(x == '\n' || x == EOF) |
| 32 | break; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /* gets a number from stdin and cleans up after itself */ |
| 37 | unsigned int get_unum(void) |