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

Guardian Native C Library Calls (g - i) getchar(3)
NAME
getchar - Gets a character from the standard 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 getchar(void);
PARAMETERS
None.
DESCRIPTION
The getchar() function returns the next byte from the standard input stream and moves the le
pointer, if dened, ahead one byte.
NOTES
The getchar() function might be a macro (depending on the compile-time denitions used in the
source). Consequently, you cannot use this interface where a function is necessary; for example,
a subroutine pointer cannot point to it. 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 le or upon an error. The function sets errno when an error is encountered.
ERRORS
If any of the following conditions occur, the getchar() function sets errno to the corresponding
value:
[EAGAIN] The O_NONBLOCK ag is set for the underlying input stream and the process
would be delayed by the read operation.
[EBADF] The le descriptor underlying the input stream is not a valid le 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 processs controlling terminal and either
the process is ignoring or blocking the SIGTTIN signal or the process group is
orphaned.
[ENOMEM] Insufcient memory is available for the operation.
Any error encountered during the underlying call to the read() function can cause this function
to return the corresponding errno value reported by the read() function. If your application pro-
gram encounters an errno value not listed above, refer to the read(2) reference page either
online or in the Open System Services System Calls Reference Manual for information about the
cause of that error.
527192-005 Hewlett-Packard Company 311