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

NAME

6       fputs - put a string on a stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       int fputs(const char *restrict s, FILE *restrict stream);
12
13

DESCRIPTION

15       The  fputs() function shall write the null-terminated string pointed to
16       by s to the stream pointed to by  stream.  The  terminating  null  byte
17       shall not be written.
18
19       The st_ctime and st_mtime fields of the file shall be marked for update
20       between the successful execution of fputs()  and  the  next  successful
21       completion  of  a  call to fflush() or fclose() on the same stream or a
22       call to exit() or abort().
23

RETURN VALUE

25       Upon successful completion, fputs() shall return a non-negative number.
26       Otherwise,  it shall return EOF, set an error indicator for the stream,
27        and set errno to indicate the error.
28

ERRORS

30       Refer to fputc() .
31
32       The following sections are informative.
33

EXAMPLES

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

APPLICATION USAGE

56       The puts() function appends a <newline> while fputs() does not.
57

RATIONALE

59       None.
60

FUTURE DIRECTIONS

62       None.
63

SEE ALSO

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