Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

Guardian Native C Library Calls (t - z) ungetc(3)
NAME
ungetc - Pushes a character back into the input stream
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdio.h>
int ungetc(
int c,
FILE *stream);
PARAMETERS
c Species a byte to be inserted into the input stream.
stream Species the input stream.
DESCRIPTION
The ungetc() function converts the byte specified by the c parameter into an unsigned char and
inserts it into the buffer associated with the input stream specified by the stream parameter. This
causes the next call to the getc() function to return c.
If the c parameter has a value equal to EOF, the ungetc() function does not place anything in the
buffer and the input stream is unchanged.
You can always push one byte back onto a stream. The fseek() subroutine erases all memory of
inserted characters.
NOTES
The ungetc() function does not have any effect on the external storage corresponding to the
stream.
RETURN VALUES
The ungetc() returns c if it succeeds in inserting the byte in the stream. Otherwise, it returns a
value of EOF.
ERRORS
None. This function does not set errno.
RELATED INFORMATION
Functions: fseek(3), getc(3), getwc(3), setbuf(3), ungetwc(3).
527192-018 Hewlett-Packard Company 753