Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

Guardian Native C Library Calls (f) fputc(3)
NAME
fputc - Writes a byte to a specied output stream
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <stdio.h>
int fputc(
int c,
FILE *stream);
PARAMETERS
c Species the character to be written.
stream Points to the le structure of an open le.
DESCRIPTION
The fputc() macro writes the character c to the output specied by the stream parameter. The
character is written at the position at which the le pointer is currently pointing, if dened.
With the exception of stderr, output streams are, by default, buffered if they refer to les, 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 le 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 elds of the le are marked for update between the successful exe-
cution of the fputc( ) function, and the next successful completion of a call to the fush() or
fclose( ) function on the same stream, or a call to the exit() or abort() function.
NOTES
The fputc() function is never a macro.
The fputc() function runs more slowly than putc( ), but takes less space per invocation.
RETURN VALUES
The fputc() function, upon successful completion, returns the value written. If this function
fails, it returns the constant EOF and sets errno.
ERRORS
The fputc() function fails if:
The stream parameter is not open for writing.
The output le size cannot be increased.
The stream is unbuffered.
The streams buffer needed to be ushed and the function call caused an underlying
write() or lseek() to be invoked and this underlying operation fails.
527192-007 Hewlett-Packard Company 261