HP C/iX Library Reference Manual (30026-90004)

Chapter 5 379
HP C/iX Library Function Descriptions
ungetc
of the comparison.
#include <stdio.h>
main()
{
int c1, c2;
c1 = getchar();
ungetc(c1, stdin);
c2 = getchar();
if(c1 == c2)
printf("They're the same!\n");
else
printf("Oops! They're different!\n");
}
At least one character may be pushed back if data has been read from the stream prior to
the push-back attempt and if the stream is buffered.
See Also
fseek(), fsetpos(), ftell(), fclose(), ferror(), fopen(), fread(), fgetc(), gets(),
putc(), fputc(), scanf(), fscanf(), ANSI C 4.9.7.11, POSIX.1 8.1