Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
Guardian Native C Library Calls (g - i) getc(3)
NAME
getc - Gets a character from a specified 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 getc(
FILE ∗∗stream);
PARAMETERS
stream Points to the file structure of an open file.
DESCRIPTION
The getc() function returns the next byte from the input specified by the stream parameter and
moves the file pointer, if defined, ahead one byte in stream.
NOTES
The getc() function might be a macro (depending on the compile-time definitions used in the
source). Consequently, you cannot use this interface where a function is necessary; for example,
a subroutine pointer cannot point to it. In addition, getc() does not work correctly with a stream
parameter that has side effects. In particular, the following does not work:
getc(*f++)
When a function is necessary, use the fgetc() function instead.
RETURN VALUES
This function and macro returns a character if successful. It returns the integer constant EOF at
the end of the file or upon an error. The function sets errno when an error is encountered.
ERRORS
If any of the following conditions occur, the getc() function sets errno to the corresponding
value:
[EAGAIN] The O_NONBLOCK flag is set for the underlying input stream and the process
would be delayed by the read operation.
[EBADF] The file descriptor underlying the input stream is not a valid file descriptor or is
not open for reading.
[EINTR] The read operation was interrupted by a signal which was caught and no data
was transferred.
[ENXIO] A request was made on a nonexistent device, or the request was outside the
capabilities of the device.
[EIO] The call is attempting to read from the process’s controlling terminal and either
the process is ignoring or blocking the SIGTTIN signal or the process group is
orphaned.
527192-007 Hewlett-Packard Company 3−9