Open System Services System Calls Reference Manual (G06.28+)

spt_getcharx(2) OSS System Calls Reference Manual
NAME
spt_getcharx - Gets a character from the standard input stream (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <stdio.h>]
#include <spthread.h>
int spt_getcharx (void);
PARAMETERS
None.
DESCRIPTION
The spt_getcharx() function is the thread-aware version of the getchar() function.
The spt_getcharx() function returns the next byte from the standard input stream and moves the
le pointer, if dened, ahead one byte.
NOTES
The macro to map getchar() to spt_getcharx() is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been dened in the following manner before
including spthread.h:
#dene SPT_THREAD_AWARE_NONBLOCK
The alias to link getchar() to spt_getcharx() is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been dened in the following manner
before including spthread.h:
#dene SPT_THREAD_AWARE_PRAGMA_NONBLOCK
The spt_getcharx() 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
spt_fgetcx() 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.
If the le descriptor underlying stdin becomes invalid (is closed by another thread), EOF is
returned with an errno value of [EBADF]. If a signal is received via the pthread_kill() function
and is not blocked, ignored, or handled, EOF is returned with an errno value of [EINTR].
ERRORS
If any of the following conditions occur, the spt_getcharx() 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.
7180 Hewlett-Packard Company 527186-005