]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/puts.3
time.1, atexit.3, bsearch.3, dlopen.3, envz_add.3, errno.3, fmtmsg.3, getgrent_r...
[thirdparty/man-pages.git] / man3 / puts.3
CommitLineData
bf5a7247 1.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
fea681da
MK
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\" License.
23.\" Modified Sat Jul 24 18:42:59 1993 by Rik Faith (faith@cs.unc.edu)
71d9e7ae 24.TH PUTS 3 2011-09-28 "GNU" "Linux Programmer's Manual"
fea681da
MK
25.SH NAME
26fputc, fputs, putc, putchar, puts \- output of characters and strings
27.SH SYNOPSIS
28.nf
29.B #include <stdio.h>
30.sp
31.BI "int fputc(int " c ", FILE *" stream );
5895e7eb 32
fea681da 33.BI "int fputs(const char *" "s" ", FILE *" "stream" );
5895e7eb 34
fea681da 35.BI "int putc(int " c ", FILE *" stream );
5895e7eb 36
fea681da 37.BI "int putchar(int " c );
5895e7eb 38
fea681da 39.BI "int puts(const char *" "s" );
5895e7eb 40.fi
fea681da 41.SH DESCRIPTION
63aa9df0 42.BR fputc ()
fea681da
MK
43writes the character
44.IR c ,
45cast to an
9ff08aad 46.IR "unsigned char" ,
fea681da
MK
47to
48.IR stream .
49.PP
63aa9df0 50.BR fputs ()
fea681da
MK
51writes the string
52.I s
53to
54.IR stream ,
9f8e673e 55without its terminating null byte (\(aq\\0\(aq).
fea681da 56.PP
63aa9df0 57.BR putc ()
fea681da 58is equivalent to
63aa9df0 59.BR fputc ()
fea681da
MK
60except that it may be implemented as a macro which evaluates
61.I stream
62more than once.
63.PP
64.BI "putchar(" c );
65is equivalent to
66.BI "putc(" c , stdout ).
67.PP
63aa9df0 68.BR puts ()
fea681da
MK
69writes the string
70.I s
71and a trailing newline
72to
73.IR stdout .
74.PP
75Calls to the functions described here can be mixed with each other and with
76calls to other output functions from the
f19a0f03 77.I stdio
fea681da
MK
78library for the same output stream.
79.PP
24b74457 80For nonlocking counterparts, see
fea681da
MK
81.BR unlocked_stdio (3).
82.SH "RETURN VALUE"
c13182ef
MK
83.BR fputc (),
84.BR putc ()
e1d6264d
MK
85and
86.BR putchar ()
fea681da 87return the character written as an
9ff08aad 88.I unsigned char
fea681da 89cast to an
9ff08aad 90.I int
fea681da
MK
91or
92.B EOF
93on error.
94.PP
c13182ef
MK
95.BR puts ()
96and
e1d6264d 97.BR fputs ()
2fda57bd 98return a nonnegative number on success, or
fea681da
MK
99.B EOF
100on error.
fea681da 101.SH "CONFORMING TO"
44a2c328 102C89, C99.
fea681da
MK
103.SH BUGS
104It is not advisable to mix calls to output functions from the
f19a0f03 105.I stdio
4d9b6984 106library with low-level calls to
91fe9d5c 107.BR write (2)
fea681da
MK
108for the file descriptor associated with the same output stream; the results
109will be undefined and very probably not what you want.
110.SH "SEE ALSO"
111.BR write (2),
112.BR ferror (3),
113.BR fopen (3),
1709027c
MK
114.BR fputwc (3),
115.BR fputws (3),
fea681da
MK
116.BR fseek (3),
117.BR fwrite (3),
118.BR gets (3),
1709027c 119.BR putwchar (3),
fea681da
MK
120.BR scanf (3),
121.BR unlocked_stdio (3)