Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

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 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>
size_t fwrite(
const void pointer,
size_t size,
size_t num_items,
FILE stream);
PARAMETERS
pointer Points to an array.
size Specifies the size of the variable type of the array pointed to by the pointer
parameter.
num_items Specifies 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 specified 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 undefined.
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 file size cannot be increased.
The stream is unbuffered.
The streams buffer needed to be flushed 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-018 Hewlett-Packard Company 2167