Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

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 native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
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 specied by the c parameter into an unsigned char and
inserts it into the buffer associated with the input stream specied 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-007 Hewlett-Packard Company 739