1FPUTS(3P)                  POSIX Programmer's Manual                 FPUTS(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       fputs - put a string on a stream
13

SYNOPSIS

15       #include <stdio.h>
16
17       int fputs(const char *restrict s, FILE *restrict stream);
18
19

DESCRIPTION

21       The fputs() function shall write the null-terminated string pointed  to
22       by  s  to  the  stream  pointed to by stream. The terminating null byte
23       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 fputs() and the next successful
27       completion of a call to fflush() or fclose() on the same  stream  or  a
28       call to exit() or abort().
29

RETURN VALUE

31       Upon successful completion, fputs() shall return a non-negative number.
32       Otherwise, it shall return EOF, set an error indicator for the  stream,
33       and set errno 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       fputs().  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              fputs(asctime(localtime(&now)), stdout);
57              printf("There are still %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(),   putc(),   puts(),   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                            FPUTS(3P)
Impressum