Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
putw - put word on stream
&pagelevel(4)&pagelevel
Syntax | #include <stdio.h> int putw(int w, FILE *stream); |
Description | putw() writes the word w to the output stream stream at the position at which the file offset, if defined, is pointing. The size of a word corresponds to the size of a type int and varies from machine to machine. In the C runtime system, the size of a type int is 4 bytes. putw() neither assumes nor causes special alignment in the file.
The structure components st_ctime and st_mtime of the file are marked for changing between successful execution of putw() and the next successful completion of a call to fflush() or fclose() for the same data stream or a call to exit() or abort() (see sys/stat.h). putw() is not thread-safe.
|
Return val. | 0 | if successful. |
| != 0
| if an error occurs. The error indicator for the stream is set, and errno is set to indicate the error. |
| BS2000 |
| EOF
| if an error occurs. (End) |
Errors | See fputc() . |
Notes | Due to possible differences in word length and byte ordering, files written using putw() are machine-dependent, and may not be readable using getw() on a different processor. Since putw() does not indicate errors explicitly (-1 is a valid integer value), it is advisable to also use ferror() to verify whether an error occurred before or after writing. The bytes are not written immediately to the external file but are stored in an internal C buffer (see section “Buffering streams”). Control characters for white space (\n , \t , etc.) are converted to their appropriate effect when output to text files, depending on the type of text file (see section “White-spacecharacters”). The program environment determines whether putw() is executed for a BS2000 or POSIX file. |
See also | fopen() , fputc() , fwrite() , getw() , stdio.h , sys/stat.h .
|