1PUTS(3) Linux Programmer's Manual PUTS(3)
2
3
4
6 fputc, fputs, putc, putchar, puts - output of characters and strings
7
9 #include <stdio.h>
10
11 int fputc(int c, FILE *stream);
12
13 int fputs(const char *s, FILE *stream);
14
15 int putc(int c, FILE *stream);
16
17 int putchar(int c);
18
19 int puts(const char *s);
20
22 fputc() writes the character c, cast to an unsigned char, to stream.
23
24 fputs() writes the string s to stream, without its terminating null
25 byte ('\0').
26
27 putc() is equivalent to fputc() except that it may be implemented as a
28 macro which evaluates stream more than once.
29
30 putchar(c) is equivalent to putc(c, stdout).
31
32 puts() writes the string s and a trailing newline to stdout.
33
34 Calls to the functions described here can be mixed with each other and
35 with calls to other output functions from the stdio library for the
36 same output stream.
37
38 For nonlocking counterparts, see unlocked_stdio(3).
39
41 fputc(), putc() and putchar() return the character written as an
42 unsigned char cast to an int or EOF on error.
43
44 puts() and fputs() return a nonnegative number on success, or EOF on
45 error.
46
48 For an explanation of the terms used in this section, see
49 attributes(7).
50
51 ┌──────────────────────────┬───────────────┬─────────┐
52 │Interface │ Attribute │ Value │
53 ├──────────────────────────┼───────────────┼─────────┤
54 │fputc(), fputs(), putc(), │ Thread safety │ MT-Safe │
55 │putchar(), puts() │ │ │
56 └──────────────────────────┴───────────────┴─────────┘
58 POSIX.1-2001, POSIX.1-2008, C89, C99.
59
61 It is not advisable to mix calls to output functions from the stdio
62 library with low-level calls to write(2) for the file descriptor asso‐
63 ciated with the same output stream; the results will be undefined and
64 very probably not what you want.
65
67 write(2), ferror(3), fgets(3), fopen(3), fputwc(3), fputws(3),
68 fseek(3), fwrite(3), putwchar(3), scanf(3), unlocked_stdio(3)
69
71 This page is part of release 5.07 of the Linux man-pages project. A
72 description of the project, information about reporting bugs, and the
73 latest version of this page, can be found at
74 https://www.kernel.org/doc/man-pages/.
75
76
77
78GNU 2018-04-30 PUTS(3)