1PUTS(3P)                   POSIX Programmer's Manual                  PUTS(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       puts - put a string on standard output
13

SYNOPSIS

15       #include <stdio.h>
16
17       int puts(const char *s);
18
19

DESCRIPTION

21       The puts() function shall write the string pointed to by s, followed by
22       a <newline>, to the standard output stream stdout. The terminating null
23       byte shall not be written.
24
25       The st_ctime and st_mtime fields of the file shall be marked for update
26       between the successful execution of puts() and the next successful com‐
27       pletion of a call to fflush() or fclose() on the same stream or a  call
28       to exit() or abort().
29

RETURN VALUE

31       Upon  successful completion, puts() shall return a non-negative number.
32       Otherwise, it shall return EOF, shall set an error  indicator  for  the
33       stream,  and errno shall be set to indicate the error.
34

ERRORS

36       Refer to fputc().
37
38       The following sections are informative.
39

EXAMPLES

41   Printing to Standard Output
42       The  following  example  gets the current time, converts it to a string
43       using localtime() and asctime(), and prints it to standard output using
44       puts().  It  then prints the number of minutes to an event for which it
45       is waiting.
46
47
48              #include <time.h>
49              #include <stdio.h>
50              ...
51              time_t now;
52              int minutes_to_event;
53              ...
54              time(&now);
55              printf("The time is ");
56              puts(asctime(localtime(&now)));
57              printf("There are %d minutes to the event.\n",
58                  minutes_to_event);
59              ...
60

APPLICATION USAGE

62       The puts() function appends a <newline>, while fputs() does not.
63

RATIONALE

65       None.
66

FUTURE DIRECTIONS

68       None.
69

SEE ALSO

71       fopen(),   fputs(),   putc(),   the   Base   Definitions   volume    of
72       IEEE Std 1003.1-2001, <stdio.h>
73
75       Portions  of  this text are reprinted and reproduced in electronic form
76       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
77       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
78       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
79       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
80       event of any discrepancy between this version and the original IEEE and
81       The  Open Group Standard, the original IEEE and The Open Group Standard
82       is the referee document. The original Standard can be  obtained  online
83       at http://www.opengroup.org/unix/online.html .
84
85
86
87IEEE/The Open Group                  2003                             PUTS(3P)
Impressum