1FPUTC(3P)                  POSIX Programmer's Manual                 FPUTC(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       fputc — put a byte on a stream
13

SYNOPSIS

15       #include <stdio.h>
16
17       int fputc(int c, FILE *stream);
18

DESCRIPTION

20       The functionality described on this reference page is aligned with  the
21       ISO C  standard.  Any  conflict between the requirements described here
22       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
23       defers to the ISO C standard.
24
25       The  fputc() function shall write the byte specified by c (converted to
26       an unsigned char) to the output stream pointed to  by  stream,  at  the
27       position  indicated  by  the associated file-position indicator for the
28       stream (if defined), and shall advance the indicator appropriately.  If
29       the  file  cannot  support  positioning  requests, or if the stream was
30       opened with append mode, the byte  shall  be  appended  to  the  output
31       stream.
32
33       The  last  data  modification and last file status change timestamps of
34       the file shall be marked for update between the successful execution of
35       fputc()  and  the  next  successful completion of a call to fflush() or
36       fclose() on the same stream or a call to exit() or abort().
37

RETURN VALUE

39       Upon successful completion, fputc() shall return the value it has writ‐
40       ten. Otherwise, it shall return EOF, the error indicator for the stream
41       shall be set, and errno shall be set to indicate the error.
42

ERRORS

44       The fputc() function shall fail if either the stream is  unbuffered  or
45       the stream's buffer needs to be flushed, and:
46
47       EAGAIN The  O_NONBLOCK  flag  is set for the file descriptor underlying
48              stream and the thread would be delayed in the write operation.
49
50       EBADF  The file descriptor  underlying  stream  is  not  a  valid  file
51              descriptor open for writing.
52
53       EFBIG  An  attempt was made to write to a file that exceeds the maximum
54              file size.
55
56       EFBIG  An attempt was made to write to a file  that  exceeds  the  file
57              size limit of the process.
58
59       EFBIG  The  file  is a regular file and an attempt was made to write at
60              or beyond the offset maximum.
61
62       EINTR  The write operation was terminated due to the receipt of a  sig‐
63              nal, and no data was transferred.
64
65       EIO    A physical I/O error has occurred, or the process is a member of
66              a background process group attempting to write to  its  control‐
67              ling terminal, TOSTOP is set, the calling thread is not blocking
68              SIGTTOU, the process is not ignoring SIGTTOU,  and  the  process
69              group  of  the  process  is  orphaned.   This  error may also be
70              returned under implementation-defined conditions.
71
72       ENOSPC There was no free space remaining on the device  containing  the
73              file.
74
75       EPIPE  An  attempt  is made to write to a pipe or FIFO that is not open
76              for reading by any process. A SIGPIPE signal shall also be  sent
77              to the thread.
78
79       The fputc() function may fail if:
80
81       ENOMEM Insufficient storage space is available.
82
83       ENXIO  A  request  was made of a nonexistent device, or the request was
84              outside the capabilities of the device.
85
86       The following sections are informative.
87

EXAMPLES

89       None.
90

APPLICATION USAGE

92       None.
93

RATIONALE

95       None.
96

FUTURE DIRECTIONS

98       None.
99

SEE ALSO

101       Section 2.5, Standard  I/O  Streams,  ferror(),  fopen(),  getrlimit(),
102       putc(), puts(), setbuf(), ulimit()
103
104       The Base Definitions volume of POSIX.1‐2017, <stdio.h>
105
107       Portions  of  this text are reprinted and reproduced in electronic form
108       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
109       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
110       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
111       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
112       event of any discrepancy between this version and the original IEEE and
113       The  Open Group Standard, the original IEEE and The Open Group Standard
114       is the referee document. The original Standard can be  obtained  online
115       at http://www.opengroup.org/unix/online.html .
116
117       Any  typographical  or  formatting  errors that appear in this page are
118       most likely to have been introduced during the conversion of the source
119       files  to  man page format. To report such errors, see https://www.ker
120       nel.org/doc/man-pages/reporting_bugs.html .
121
122
123
124IEEE/The Open Group                  2017                            FPUTC(3P)
Impressum