ioctl_tty.2: Update DTR example
[man-pages.git] / man3 / puts.3
blob41bb0f808c0ed2d18963017d3d3a9bd9371b0343
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified Sat Jul 24 18:42:59 1993 by Rik Faith (faith@cs.unc.edu)
26 .TH PUTS 3  2021-03-22 "GNU" "Linux Programmer's Manual"
27 .SH NAME
28 fputc, fputs, putc, putchar, puts \- output of characters and strings
29 .SH SYNOPSIS
30 .nf
31 .B #include <stdio.h>
32 .PP
33 .BI "int fputc(int " c ", FILE *" stream );
34 .BI "int putc(int " c ", FILE *" stream );
35 .BI "int putchar(int " c );
36 .PP
37 .BI "int fputs(const char *restrict " s ", FILE *restrict " stream );
38 .BI "int puts(const char *" s );
39 .fi
40 .SH DESCRIPTION
41 .BR fputc ()
42 writes the character
43 .IR c ,
44 cast to an
45 .IR "unsigned char" ,
47 .IR stream .
48 .PP
49 .BR putc ()
50 is equivalent to
51 .BR fputc ()
52 except that it may be implemented as a macro which evaluates
53 .I stream
54 more than once.
55 .PP
56 .BI "putchar(" c )
57 is equivalent to
58 .BI "putc(" c ", " stdout ) \fR.
59 .PP
60 .BR fputs ()
61 writes the string
62 .I s
64 .IR stream ,
65 without its terminating null byte (\(aq\e0\(aq).
66 .PP
67 .BR puts ()
68 writes the string
69 .I s
70 and a trailing newline
72 .IR stdout .
73 .PP
74 Calls to the functions described here can be mixed with each other and with
75 calls to other output functions from the
76 .I stdio
77 library for the same output stream.
78 .PP
79 For nonlocking counterparts, see
80 .BR unlocked_stdio (3).
81 .SH RETURN VALUE
82 .BR fputc (),
83 .BR putc (),
84 and
85 .BR putchar ()
86 return the character written as an
87 .I unsigned char
88 cast to an
89 .I int
91 .B EOF
92 on error.
93 .PP
94 .BR puts ()
95 and
96 .BR fputs ()
97 return a nonnegative number on success, or
98 .B EOF
99 on error.
100 .SH ATTRIBUTES
101 For an explanation of the terms used in this section, see
102 .BR attributes (7).
103 .ad l
106 allbox;
107 lbx lb lb
108 l l l.
109 Interface       Attribute       Value
111 .BR fputc (),
112 .BR fputs (),
113 .BR putc (),
114 .BR putchar (),
115 .BR puts ()
116 T}      Thread safety   MT-Safe
120 .sp 1
121 .SH CONFORMING TO
122 POSIX.1-2001, POSIX.1-2008, C89, C99.
123 .SH BUGS
124 It is not advisable to mix calls to output functions from the
125 .I stdio
126 library with low-level calls to
127 .BR write (2)
128 for the file descriptor associated with the same output stream; the results
129 will be undefined and very probably not what you want.
130 .SH SEE ALSO
131 .BR write (2),
132 .BR ferror (3),
133 .BR fgets (3),
134 .BR fopen (3),
135 .BR fputwc (3),
136 .BR fputws (3),
137 .BR fseek (3),
138 .BR fwrite (3),
139 .BR putwchar (3),
140 .BR scanf (3),
141 .BR unlocked_stdio (3)