2008-07-08 14:32:54 +00:00
|
|
|
.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" License.
|
|
|
|
.\" Modified Sat Jul 24 18:42:59 1993 by Rik Faith (faith@cs.unc.edu)
|
|
|
|
.TH PUTS 3 1993-04-04 "GNU" "Linux Programmer's Manual"
|
|
|
|
.SH NAME
|
|
|
|
fputc, fputs, putc, putchar, puts \- output of characters and strings
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <stdio.h>
|
|
|
|
.sp
|
|
|
|
.BI "int fputc(int " c ", FILE *" stream );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int fputs(const char *" "s" ", FILE *" "stream" );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int putc(int " c ", FILE *" stream );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int putchar(int " c );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int puts(const char *" "s" );
|
2007-12-23 13:45:24 +00:00
|
|
|
.fi
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the character
|
|
|
|
.IR c ,
|
|
|
|
cast to an
|
2006-02-09 20:24:53 +00:00
|
|
|
.IR "unsigned char" ,
|
2004-11-03 13:51:07 +00:00
|
|
|
to
|
|
|
|
.IR stream .
|
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputs ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the string
|
|
|
|
.I s
|
|
|
|
to
|
|
|
|
.IR stream ,
|
|
|
|
without its trailing
|
2008-06-09 15:49:35 +00:00
|
|
|
.BR \(aq\e0\(aq .
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR putc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
is equivalent to
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
except that it may be implemented as a macro which evaluates
|
|
|
|
.I stream
|
|
|
|
more than once.
|
|
|
|
.PP
|
|
|
|
.BI "putchar(" c );
|
|
|
|
is equivalent to
|
|
|
|
.BI "putc(" c , stdout ).
|
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR puts ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the string
|
|
|
|
.I s
|
|
|
|
and a trailing newline
|
|
|
|
to
|
|
|
|
.IR stdout .
|
|
|
|
.PP
|
|
|
|
Calls to the functions described here can be mixed with each other and with
|
|
|
|
calls to other output functions from the
|
2007-06-23 07:56:56 +00:00
|
|
|
.I stdio
|
2004-11-03 13:51:07 +00:00
|
|
|
library for the same output stream.
|
|
|
|
.PP
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
For nonlocking counterparts, see
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR unlocked_stdio (3).
|
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR fputc (),
|
|
|
|
.BR putc ()
|
2005-10-19 07:29:28 +00:00
|
|
|
and
|
|
|
|
.BR putchar ()
|
2004-11-03 13:51:07 +00:00
|
|
|
return the character written as an
|
2006-02-09 20:24:53 +00:00
|
|
|
.I unsigned char
|
2004-11-03 13:51:07 +00:00
|
|
|
cast to an
|
2006-02-09 20:24:53 +00:00
|
|
|
.I int
|
2004-11-03 13:51:07 +00:00
|
|
|
or
|
|
|
|
.B EOF
|
|
|
|
on error.
|
|
|
|
.PP
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR puts ()
|
|
|
|
and
|
2005-10-19 07:29:28 +00:00
|
|
|
.BR fputs ()
|
_syscall.2, accept.2, epoll_create.2, inotify_add_watch.2, ioctl.2, msgget.2, msgop.2, open.2, prctl.2, sched_setscheduler.2, semctl.2, semget.2, swapon.2, addseverity.3, cacosh.3, csqrt.3, dirfd.3, drand48.3, fputws.3, mq_send.3, posix_openpt.3, puts.3, sched_getcpu.3, shm_open.3, sqrt.3, sysconf.3, tgamma.3, ulimit.3, credentials.7, svipc.7: Global fix: s/non-negative/nonnegative/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:44:48 +00:00
|
|
|
return a nonnegative number on success, or
|
2004-11-03 13:51:07 +00:00
|
|
|
.B EOF
|
|
|
|
on error.
|
|
|
|
.SH "CONFORMING TO"
|
2008-07-15 13:39:17 +00:00
|
|
|
C89, C99.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH BUGS
|
|
|
|
It is not advisable to mix calls to output functions from the
|
2007-06-23 07:56:56 +00:00
|
|
|
.I stdio
|
2005-07-06 07:41:37 +00:00
|
|
|
library with low-level calls to
|
2007-05-12 01:02:19 +00:00
|
|
|
.BR write (2)
|
2004-11-03 13:51:07 +00:00
|
|
|
for the file descriptor associated with the same output stream; the results
|
|
|
|
will be undefined and very probably not what you want.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR write (2),
|
|
|
|
.BR ferror (3),
|
|
|
|
.BR fopen (3),
|
2006-02-09 20:57:44 +00:00
|
|
|
.BR fputwc (3),
|
|
|
|
.BR fputws (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR fseek (3),
|
|
|
|
.BR fwrite (3),
|
|
|
|
.BR gets (3),
|
2006-02-09 20:57:44 +00:00
|
|
|
.BR putwchar (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR scanf (3),
|
|
|
|
.BR unlocked_stdio (3)
|