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

System Functions (s and S) spt_fgetcx(2)
NAME
spt_fgetcx - 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_fgetcx (
FILE *stream
);
PARAMETERS
stream Points to the le structure of an open le.
DESCRIPTION
The spt_fgetcx() function is the thread-aware version of the fgetc() function.
The spt_fgetcx() 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 fgetc() to spt_fgetcx() 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 fgetc() to spt_fgetcx() 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
RETURN VALUES
The spt_fgetcx() function 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_fgetcx() 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.
[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.
527186-005 Hewlett-Packard Company 7125