| ungetc |
(int ch, String stream) |
yoix.stdio |
| |
Puts the character represented by
ch
back in the input
stream,
so it will be the next character read from that
stream,
and returns
ch
if everything worked, or
-1
if an error occurred.
| |
| Example: |
On a UNIX-like system the program,
import yoix.stdio.*;
String line = "This is a fake line\n";
File file;
int n;
if ((file = fopen("/etc/passwd", "r")) != NULL) {
for (n = line@sizeof - 1; n >= 0; n--)
ungetc(line[n], file);
while (fgets(line, line@sizeof, file) != NULL)
fputs(line, stdout);
fclose(file);
}
copies our fake line and then the system password file
to standard output.
| | |
| Return: |
int
| | |
| See Also: |
getc,
getchar,
putc,
putchar
|
|
Yoix is a registered trademark of AT&T Inc.
|