Index of Section 3 Manual Pages
| Interix / SUA | putw.3 | Interix / SUA |
putw(3) putw(3)
getw()
NAME
getw(), putw() - get word from or put word on a stream
SYNOPSIS
#include
int getw (FILE *stream)
int putw (int w, FILE *stream)
DESCRIPTION
The getw(3) function returns the next word (integer) from the input
referenced by the stream argument. The getw(3) function increments the
associated file pointer, if defined, to point to the next word.
The putw(3) function writes the word (integer) identified by the w
argument to the output stream referenced by the stream argument at the
position of the file pointer, if defined.
The size of a word is the size of an integer and varies from computer to
computer. The getw(3) and putw(3) functions neither assume nor cause
special alignment in the file.
RETURN VALUES
If successful, getw(3) returns the next word from the stream. If the
stream is at end-of-file or a read error occurs, getw(3) returns EOF.
Since EOF is a valid integer value, you must use feof(3) and ferror(3) to
distinguish between end-of-file and error. If an error occurs, the global
variable errno is set to indicate the error.
If successful, putw(3) returns 0; otherwise, it returns nonzero.
ERRORS
The getw(3) function can fail for the following reason:
[EOVERFLOW]
The file specified by stream is a regular file and an attempt was made
to read at or beyond the offset maximum associated with the
corresponding stream.
The putw(3) function can fail for the following reason:
[EFBIG]
Either the stream is unbuffered or the stream's buffer needs to be
flushed, the file specified by stream is a regular file, and an
attempt was made to write at or beyond the offset maximum associated
with the corresponding stream.
NOTE
Because of possible differences in word length and byte ordering, files
written using putw(3) are implementation dependent and may not be read
using getw(3) on a computer with a different processor architecture.
SEE ALSO
ferror(3)
fread(3)
fopen(3)
getc(3)
putc(3)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.