]> git.saurik.com Git - apple/libc.git/blob - stdio/fputs.3
4c4ca1ee898251e5b42e94a2be7094eeb2fabe01
[apple/libc.git] / stdio / fputs.3
1 .\" Copyright (c) 1990, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Chris Torek and the American National Standards Committee X3,
6 .\" on Information Processing Systems.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)fputs.3 8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/lib/libc/stdio/fputs.3,v 1.14 2007/04/19 14:01:04 phk Exp $
34 .\"
35 .Dd June 4, 1993
36 .Dt FPUTS 3
37 .Os
38 .Sh NAME
39 .Nm fputs ,
40 .Nm puts
41 .Nd output a line to a stream
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In stdio.h
46 .Ft int
47 .Fo fputs
48 .Fa "const char *restrict s"
49 .Fa "FILE *restrict stream"
50 .Fc
51 .Ft int
52 .Fo puts
53 .Fa "const char *s"
54 .Fc
55 .Sh DESCRIPTION
56 The function
57 .Fn fputs
58 writes the string pointed to by
59 .Fa s
60 to the stream pointed to by
61 .Fa stream .
62 .\" The terminating
63 .\" .Dv NUL
64 .\" character is not written.
65 .Pp
66 The function
67 .Fn puts
68 writes the string
69 .Fa s ,
70 and a terminating newline character,
71 to the stream
72 .Dv stdout .
73 .Sh RETURN VALUES
74 The functions
75 .Fn fputs
76 and
77 .Fn puts
78 return a nonnegative integer on success and
79 .Dv EOF
80 on error.
81 .Sh ERRORS
82 .Bl -tag -width Er
83 .It Bq Er EBADF
84 The
85 .Fa stream
86 argument
87 is not a writable stream.
88 .El
89 .Pp
90 The functions
91 .Fn fputs
92 and
93 .Fn puts
94 may also fail and set
95 .Va errno
96 for any of the errors specified for the routines
97 .Xr write 2 .
98 .Sh COMPATIBILITY
99 .Fn fputs
100 now returns a non-negative number (as opposed to 0)
101 on successful completion.
102 As a result, many tests (e.g., "fputs() == 0", "fputs() != 0")
103 do not give the desired result.
104 Use "fputs() != EOF" or "fputs() == EOF"
105 to determine success or failure.
106 .Sh SEE ALSO
107 .Xr ferror 3 ,
108 .Xr fputws 3 ,
109 .Xr putc 3 ,
110 .Xr stdio 3
111 .Sh STANDARDS
112 The functions
113 .Fn fputs
114 and
115 .Fn puts
116 conform to
117 .St -isoC .
118 While not mentioned in the standard, both
119 .Fn fputs
120 and
121 .Fn puts
122 print
123 .Ql (null)
124 if
125 .Fa str
126 is
127 .Dv NULL .