plain-C stdin buffer garbage and newline-eaters
问题 I have a question concerning stdin buffer content inspection. This acclaimed line of code: int c; while((c = getchar()) != '\n' && c != EOF); deals efficiently with discarding stdin-buffer garbage, in case there is a garbage found. In case the buffer is empty, the program execution wouldn't go past it. Is there a way of checking if there is garbage in the stdin-buffer at all (no matter if it's there by user error, typeahead or whichever reason), and executing the "fflush-replacement line"