1getw(3) Library Functions Manual getw(3)
2
3
4
6 getw, putw - input and output of words (ints)
7
9 Standard C library (libc, -lc)
10
12 #include <stdio.h>
13
14 int getw(FILE *stream);
15 int putw(int w, FILE *stream);
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 getw(), putw():
20 Since glibc 2.3.3:
21 _XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
22 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
23 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24 Before glibc 2.3.3:
25 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE
26
28 getw() reads a word (that is, an int) from stream. It's provided for
29 compatibility with SVr4. We recommend you use fread(3) instead.
30
31 putw() writes the word w (that is, an int) to stream. It is provided
32 for compatibility with SVr4, but we recommend you use fwrite(3) in‐
33 stead.
34
36 Normally, getw() returns the word read, and putw() returns 0. On er‐
37 ror, they return EOF.
38
40 For an explanation of the terms used in this section, see at‐
41 tributes(7).
42
43 ┌────────────────────────────────────────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├────────────────────────────────────────────┼───────────────┼─────────┤
46 │getw(), putw() │ Thread safety │ MT-Safe │
47 └────────────────────────────────────────────┴───────────────┴─────────┘
48
50 None.
51
53 SVr4, SUSv2.
54
56 The value returned on error is also a legitimate data value. ferror(3)
57 can be used to distinguish between the two cases.
58
60 ferror(3), fread(3), fwrite(3), getc(3), putc(3)
61
62
63
64Linux man-pages 6.04 2023-03-30 getw(3)