putw()

Put a word on a stream

Synopsis:

#include <stdio.h>

int putw( int w,
          FILE *stream );

Arguments:

w
The word that you want to write.
stream
The stream that you want to write a word on.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

The putw() function writes the C int (word) w to the standard I/O output stream (at the position of the file pointer, if defined). The size of a word is the size of an integer, and varies from machine to machine. The putw() function neither assumes nor causes special alignment in the file.

Returns:

0
Success.
1
An error occurred; errno is set.

Errors:

EFBIG
The file is a regular file and an attempt was made to write at or beyond the offset maximum.

Classification:

Legacy Unix

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

Because of possible differences in word length and byte ordering, files written using putw() are machine-dependent, and might not be read correctly using getw() on a different processor.