Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (n - r) putchar_unlocked(3)
NAME
putchar_unlocked - Writes a byte to the standard output stream but does not lock the stream
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdio.h>
int putchar_unlocked(
int c);
PARAMETERS
c Specifies the character to be written.
DESCRIPTION
The putchar_unlocked() function writes the character c to the standard output stream. The
character is written at the position at which the file pointer is currently pointing, if defined. The
putchar_unlocked() function is functionally equivalent to the putchar( ) function except that it
does not perform any internal locking of the stream.
The putchar_unlocked() function should only be used by multi-threaded applications that have
already used the flockfile( ) or ftrylockfile() function to acquire a mutual exclusion lock for the
stream.
With the exception of stderr, output streams are, by default, buffered if they refer to files, or line
buffered if they refer to terminals. The standard error output stream, stderr, is unbuffered by
default, but using the freopen( ) function causes it to become buffered or line buffered. Use the
setbuf() function to change the stream buffering strategy.
When an output stream is unbuffered, information is queued for writing on the destination file or
terminal as soon as it is written. When an output stream is buffered, many characters are saved
and written as a block. When an output stream is line-buffered, each line of output is queued for
writing on the destination terminal as soon as the line is completed (that is, as soon as a newline
character is written or terminal input is requested).
The st_ctime and st_mtime fields of the file are marked for update between the successful exe-
cution of the putchar_unlocked() function, and the next successful completion of a call to the
fflush() or fclose( ) function on the same stream, or a call to the exit() or abort() function.
NOTES
The putchar_unlocked() 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 fputc() function instead.
RETURN VALUES
If successful, the putchar_unlocked() function and macro returns the value written. If this func-
tion or macro fails, the integer constant EOF is returned. When an error is encountered, errno is
set.
ERRORS
The putchar_unlocked() function fails if:
• The stream is not open for writing.
• The output file size cannot be increased.
527192-018 Hewlett-Packard Company 5−63