]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/fputs.3
Libc-1439.100.3.tar.gz
[apple/libc.git] / stdio / FreeBSD / fputs.3
CommitLineData
5b2abdfb 1.\" Copyright (c) 1990, 1991, 1993
e9ce8d39
A
2.\" The Regents of the University of California. All rights reserved.
3.\"
5b2abdfb
A
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.\"
e9ce8d39
A
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.
e9ce8d39
A
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.\"
5b2abdfb 32.\" @(#)fputs.3 8.1 (Berkeley) 6/4/93
1f2f436a 33.\" $FreeBSD: src/lib/libc/stdio/fputs.3,v 1.14 2007/04/19 14:01:04 phk Exp $
e9ce8d39 34.\"
5b2abdfb
A
35.Dd June 4, 1993
36.Dt FPUTS 3
e9ce8d39
A
37.Os
38.Sh NAME
5b2abdfb
A
39.Nm fputs ,
40.Nm puts
41.Nd output a line to a stream
e9ce8d39
A
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
5b2abdfb
A
45.In stdio.h
46.Ft int
ad3c9f2a
A
47.Fo fputs
48.Fa "const char *restrict s"
49.Fa "FILE *restrict stream"
50.Fc
e9ce8d39 51.Ft int
ad3c9f2a
A
52.Fo puts
53.Fa "const char *s"
54.Fc
e9ce8d39 55.Sh DESCRIPTION
5b2abdfb
A
56The function
57.Fn fputs
58writes the string pointed to by
ad3c9f2a 59.Fa s
5b2abdfb
A
60to the stream pointed to by
61.Fa stream .
62.\" The terminating
63.\" .Dv NUL
64.\" character is not written.
65.Pp
66The function
67.Fn puts
68writes the string
ad3c9f2a 69.Fa s ,
5b2abdfb
A
70and a terminating newline character,
71to the stream
9385eb3d 72.Dv stdout .
e9ce8d39 73.Sh RETURN VALUES
1f2f436a 74The functions
5b2abdfb 75.Fn fputs
1f2f436a 76and
5b2abdfb 77.Fn puts
1f2f436a 78return a nonnegative integer on success and
5b2abdfb
A
79.Dv EOF
80on error.
e9ce8d39 81.Sh ERRORS
e9ce8d39 82.Bl -tag -width Er
5b2abdfb 83.It Bq Er EBADF
e9ce8d39 84The
5b2abdfb 85.Fa stream
9385eb3d 86argument
5b2abdfb
A
87is not a writable stream.
88.El
89.Pp
90The functions
91.Fn fputs
92and
93.Fn puts
94may also fail and set
95.Va errno
96for any of the errors specified for the routines
97.Xr write 2 .
ad3c9f2a
A
98.Sh COMPATIBILITY
99.Fn fputs
100now returns a non-negative number (as opposed to 0)
101on successful completion.
102As a result, many tests (e.g., "fputs() == 0", "fputs() != 0")
103do not give the desired result.
104Use "fputs() != EOF" or "fputs() == EOF"
105to determine success or failure.
5b2abdfb
A
106.Sh SEE ALSO
107.Xr ferror 3 ,
9385eb3d 108.Xr fputws 3 ,
5b2abdfb
A
109.Xr putc 3 ,
110.Xr stdio 3
111.Sh STANDARDS
112The functions
113.Fn fputs
114and
115.Fn puts
116conform to
117.St -isoC .
ad3c9f2a
A
118While not mentioned in the standard, both
119.Fn fputs
120and
121.Fn puts
122print
123.Ql (null)
124if
125.Fa str
126is
127.Dv NULL .