int clearstdin(void) { char buff; do { buff = getchar(); } while ((buff != 0x0a) && (buff != EOF)); clearerr(stdin); }