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

spt_getcx(2) OSS System Calls Reference Manual
NAME
spt_getcx - Gets a character from a specied 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_getcx (
FILE stream
);
PARAMETERS
stream Points to the FILE structure of an open le.
DESCRIPTION
The spt_getcx() function is the thread-aware version of the getc() function.
The spt_getcx() function returns the next byte from the input specied by the stream parameter
and moves the le pointer, if dened, ahead one byte in stream.
NOTES
The macro to map getc() to spt_getcx() 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 getc() to spt_getcx() 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
PP The spt_getcx() 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. In addition, spt_getcx() does not work correctly
with a stream parameter that has side effects. In particular, the following does not work:
spt_getcx(*f++)
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 stream 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_getcx() function sets errno to the correspond-
ing value:
[EAGAIN] The O_NONBLOCK ag is set for the underlying input stream and the process
would be delayed by the read operation.
7182 Hewlett-Packard Company 527186-005