1puts(3)                    Library Functions Manual                    puts(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

22       fputc() writes the character c, cast to an unsigned char, to stream.
23
24       putc()  is equivalent to fputc() except that it may be implemented as a
25       macro which evaluates stream more than once.
26
27       putchar(c) is equivalent to putc(c, stdout).
28
29       fputs() writes the string s to stream,  without  its  terminating  null
30       byte ('\0').
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

RETURN VALUE

41       fputc(),  putc(),  and putchar() return the character written as an un‐
42       signed 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

ATTRIBUTES

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

STANDARDS

58       C11, POSIX.1-2008.
59

HISTORY

61       POSIX.1-2001, C89, C99.
62

BUGS

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

SEE ALSO

70       write(2),   ferror(3),   fgets(3),   fopen(3),   fputwc(3),  fputws(3),
71       fseek(3), fwrite(3), putwchar(3), scanf(3), unlocked_stdio(3)
72
73
74
75Linux man-pages 6.04              2023-03-30                           puts(3)
Impressum