Debian Codegraph @

upstream/debian-trixie/man3/getw.3

raw
1 '\" t
2 .\" Copyright (c) 1995 by Jim Van Zandt <[email protected]>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH getw 3 2024-05-02 "Linux man-pages 6.9.1"
7 .SH NAME
8 getw, putw \- input and output of words (ints)
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <stdio.h>
15 .P
16 .BI "int getw(FILE *" stream );
17 .BI "int putw(int " w ", FILE *" stream );
18 .fi
19 .P
20 .RS -4
21 Feature Test Macro Requirements for glibc (see
22 .BR feature_test_macros (7)):
23 .RE
24 .P
25 .BR getw (),
26 .BR putw ():
27 .nf
28 Since glibc 2.3.3:
29 _XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
30 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
31 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
32 Before glibc 2.3.3:
33 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE
34 .fi
35 .SH DESCRIPTION
36 .BR getw ()
37 reads a word (that is, an \fIint\fP) from \fIstream\fP.
38 It's provided for compatibility with SVr4.
39 We recommend you use
40 .BR fread (3)
41 instead.
42 .P
43 .BR putw ()
44 writes the word \fIw\fP (that is,
45 an \fIint\fP) to \fIstream\fP.
46 It is provided for compatibility with SVr4, but we recommend you use
47 .BR fwrite (3)
48 instead.
49 .SH RETURN VALUE
50 Normally,
51 .BR getw ()
52 returns the word read, and
53 .BR putw ()
54 returns 0.
55 On error, they return \fBEOF\fP.
56 .SH ATTRIBUTES
57 For an explanation of the terms used in this section, see
58 .BR attributes (7).
59 .TS
60 allbox;
61 lbx lb lb
62 l l l.
63 Interface Attribute Value
64 T{
65 .na
66 .nh
67 .BR getw (),
68 .BR putw ()
69 T} Thread safety MT-Safe
70 .TE
71 .SH STANDARDS
72 None.
73 .SH HISTORY
74 SVr4, SUSv2.
75 .SH BUGS
76 The value returned on error is also a legitimate data value.
77 .BR ferror (3)
78 can be used to distinguish between the two cases.
79 .SH SEE ALSO
80 .BR ferror (3),
81 .BR fread (3),
82 .BR fwrite (3),
83 .BR getc (3),
84 .BR putc (3)