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

Guardian Native C Library Calls (f) fwrite(3)
NAME
fwrite - Writes to an 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>
size_t fwrite(
const void pointer,
size_t size,
size_t num_items,
FILE stream);
PARAMETERS
pointer Points to an array.
size Species the size of the variable type of the array pointed to by the pointer
parameter.
num_items Species the number of items of data.
stream Species the output stream.
DESCRIPTION
The fwrite() function appends num_items of data of length size from the array pointed to by the
pointer parameter to the output stream.
The fwrite() function stops writing bytes if an error condition is encountered on the stream, or
when the number of items of data specied by the num_items parameter have been written. The
fwrite( ) function does not change the contents of the array pointed to by the pointer parameter.
NOTES
If the stream parameter is invalid, the result of calling the fwrite() function is undened.
RETURN VALUES
Upon successful completion, the fwrite( ) function returns the number of items actually
transferred. If the num_items parameter is negative or 0 (zero), no characters are transferred, and
a value of 0 (zero) is returned. If a write error occurs, the error indicator for the stream is set, and
errno is set to indicate the error.
ERRORS
The fwrite() 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.
In addition, if any of the following conditions occur, the fwrite( ) function sets errno to the
corresponding value:
527192-005 Hewlett-Packard Company 283