1GETW(3) Linux Programmer's Manual GETW(3)
2
3
4
6 getw, putw - input and output of words (ints)
7
9 #include <stdio.h>
10
11 int getw(FILE *stream);
12 int putw(int w, FILE *stream);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 getw(), putw():
17 Since glibc 2.3.3:
18 _XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
19 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
20 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
21 Before glibc 2.3.3:
22 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE
23
25 getw() reads a word (that is, an int) from stream. It's provided for
26 compatibility with SVr4. We recommend you use fread(3) instead.
27
28 putw() writes the word w (that is, an int) to stream. It is provided
29 for compatibility with SVr4, but we recommend you use fwrite(3) in‐
30 stead.
31
33 Normally, getw() returns the word read, and putw() returns 0. On er‐
34 ror, they return EOF.
35
37 For an explanation of the terms used in this section, see at‐
38 tributes(7).
39
40 ┌────────────────────────────────────────────┬───────────────┬─────────┐
41 │Interface │ Attribute │ Value │
42 ├────────────────────────────────────────────┼───────────────┼─────────┤
43 │getw(), putw() │ Thread safety │ MT-Safe │
44 └────────────────────────────────────────────┴───────────────┴─────────┘
45
47 SVr4, SUSv2. Not present in POSIX.1.
48
50 The value returned on error is also a legitimate data value. ferror(3)
51 can be used to distinguish between the two cases.
52
54 ferror(3), fread(3), fwrite(3), getc(3), putc(3)
55
57 This page is part of release 5.13 of the Linux man-pages project. A
58 description of the project, information about reporting bugs, and the
59 latest version of this page, can be found at
60 https://www.kernel.org/doc/man-pages/.
61
62
63
64GNU 2021-03-22 GETW(3)