1 2 3 4 5 6 7 8 9
#include <stdio.h> int ungetc(int c, FILE *stream) { if (stream->has_buffered_char) return EOF; stream->buffered_char = c; stream->has_buffered_char = 1; return c; }