1PUTS(3)                    Linux Programmer's Manual                   PUTS(3)
2
3
4

NAME

6       fputc, fputs, putc, putchar, puts - output of characters and strings
7

SYNOPSIS

9       #include <stdio.h>
10
11       int fputc(int c, FILE *stream);
12       int putc(int c, FILE *stream);
13       int putchar(int c);
14
15       int fputs(const char *restrict s, FILE *restrict stream);
16       int puts(const char *s);
17

DESCRIPTION

19       fputc() writes the character c, cast to an unsigned char, to stream.
20
21       putc()  is equivalent to fputc() except that it may be implemented as a
22       macro which evaluates stream more than once.
23
24       putchar(c) is equivalent to putc(c, stdout).
25
26       fputs() writes the string s to stream,  without  its  terminating  null
27       byte ('\0').
28
29       puts() writes the string s and a trailing newline to stdout.
30
31       Calls  to the functions described here can be mixed with each other and
32       with calls to other output functions from the  stdio  library  for  the
33       same output stream.
34
35       For nonlocking counterparts, see unlocked_stdio(3).
36

RETURN VALUE

38       fputc(),  putc(),  and putchar() return the character written as an un‐
39       signed char cast to an int or EOF on error.
40
41       puts() and fputs() return a nonnegative number on success,  or  EOF  on
42       error.
43

ATTRIBUTES

45       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
46       tributes(7).
47
48       ┌────────────────────────────────────────────┬───────────────┬─────────┐
49Interface                                   Attribute     Value   
50       ├────────────────────────────────────────────┼───────────────┼─────────┤
51fputc(), fputs(), putc(), putchar(), puts() │ Thread safety │ MT-Safe │
52       └────────────────────────────────────────────┴───────────────┴─────────┘
53

CONFORMING TO

55       POSIX.1-2001, POSIX.1-2008, C89, C99.
56

BUGS

58       It is not advisable to mix calls to output functions from the stdio li‐
59       brary  with low-level calls to write(2) for the file descriptor associ‐
60       ated with the same output stream; the results  will  be  undefined  and
61       very probably not what you want.
62

SEE ALSO

64       write(2),   ferror(3),   fgets(3),   fopen(3),   fputwc(3),  fputws(3),
65       fseek(3), fwrite(3), putwchar(3), scanf(3), unlocked_stdio(3)
66

COLOPHON

68       This page is part of release 5.12 of the Linux  man-pages  project.   A
69       description  of  the project, information about reporting bugs, and the
70       latest    version    of    this    page,    can     be     found     at
71       https://www.kernel.org/doc/man-pages/.
72
73
74
75GNU                               2021-03-22                           PUTS(3)
Impressum