putw()

QNX SDP8.0C Library ReferenceAPIDeveloper

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.

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:

The word written to the stream. Note that the function does not detect errors and always returns the value passed as w.

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 pointYes
Signal handlerYes
ThreadYes

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.

Page updated: