Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (n - r) putw(3)
NAME
putw - Writes a word to a 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>
int putw(
int w,
FILE *stream);
PARAMETERS
stream Points to the file structure of an open file.
w Specifies the word to be written.
DESCRIPTION
The putw( ) function writes the word (int) specified by the w parameter to the output specified by
the stream parameter. The word is written at the position at which the file pointer, if defined, is
pointing. The size of a word is the size of an integer and varies from machine to machine. The
putw( ) function does not assume or cause special alignment of the data in the file.
Because of possible differences in word length and byte ordering, files written using the putw( )
function are machine dependent, and may not be readable using the getw( ) function on a
different processor.
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 putw( ), 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.
RETURN VALUES
The putw( ) function, upon successful completion, returns a value of 0 (zero). Otherwise, it
returns a nonzero value.
ERRORS
The putw( ) function fails if either the stream is unbuffered, or the stream’s 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 putw( ) func-
tion sets errno to the corresponding value.
[EAGAIN] The O_NONBLOCK flag is set for the file descriptor underlying stream and the
process would be delayed in the write operation.
527187-017 Hewlett-Packard Company 5121