stdio.h
- We've already talked about scanf and printf, now
here are some other stdio routines you might find useful.
- fflush( stdin ); will "flush" (clear) the standard input
buffer. This is often used to prevent bad input from screwing up
multiple scanf calls.
- c = getchar(); assigns the next character on the input
buffer to c. It is the same as scanf( "%c", &c );.
- putchar(c); is the same as printf( "%c", c );.
- ungetc( c, stdin ); allows you to put a character read
in by getchar BACK onto the input buffer.
Next Slide