Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
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
file pointer, if defined, ahead one byte.
NOTES
The macro to map getchar() to spt_getcharx() is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been defined in the following manner before
including spthread.h:
#define 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 defined in the following manner
before including spthread.h:
#define SPT_THREAD_AWARE_PRAGMA_NONBLOCK
The spt_getcharx() 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. 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 file or upon an error. The function sets errno when an error is encountered.
If the file 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 these conditions occur, the spt_getcharx() 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.
7−262 Hewlett-Packard Company 527186-023