1FPUTC(3P) POSIX Programmer's Manual FPUTC(3P)
2
3
4
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
11
13 fputc — put a byte on a stream
14
16 #include <stdio.h>
17
18 int fputc(int c, FILE *stream);
19
21 The functionality described on this reference page is aligned with the
22 ISO C standard. Any conflict between the requirements described here
23 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
24 defers to the ISO C standard.
25
26 The fputc() function shall write the byte specified by c (converted to
27 an unsigned char) to the output stream pointed to by stream, at the
28 position indicated by the associated file-position indicator for the
29 stream (if defined), and shall advance the indicator appropriately. If
30 the file cannot support positioning requests, or if the stream was
31 opened with append mode, the byte shall be appended to the output
32 stream.
33
34 The last data modification and last file status change timestamps of
35 the file shall be marked for update between the successful execution of
36 fputc() and the next successful completion of a call to fflush() or
37 fclose() on the same stream or a call to exit() or abort().
38
40 Upon successful completion, fputc() shall return the value it has writ‐
41 ten. Otherwise, it shall return EOF, the error indicator for the stream
42 shall be set, and errno shall be set to indicate the error.
43
45 The fputc() function shall fail if either the stream is unbuffered or
46 the stream's buffer needs to be flushed, and:
47
48 EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying
49 stream and the thread would be delayed in the write operation.
50
51 EBADF The file descriptor underlying stream is not a valid file
52 descriptor open for writing.
53
54 EFBIG An attempt was made to write to a file that exceeds the maximum
55 file size.
56
57 EFBIG An attempt was made to write to a file that exceeds the file
58 size limit of the process.
59
60 EFBIG The file is a regular file and an attempt was made to write at
61 or beyond the offset maximum.
62
63 EINTR The write operation was terminated due to the receipt of a sig‐
64 nal, and no data was transferred.
65
66 EIO A physical I/O error has occurred, or the process is a member of
67 a background process group attempting to write to its control‐
68 ling terminal, TOSTOP is set, the calling thread is not blocking
69 SIGTTOU, the process is not ignoring SIGTTOU, and the process
70 group of the process is orphaned. This error may also be
71 returned under implementation-defined conditions.
72
73 ENOSPC There was no free space remaining on the device containing the
74 file.
75
76 EPIPE An attempt is made to write to a pipe or FIFO that is not open
77 for reading by any process. A SIGPIPE signal shall also be sent
78 to the thread.
79
80 The fputc() function may fail if:
81
82 ENOMEM Insufficient storage space is available.
83
84 ENXIO A request was made of a nonexistent device, or the request was
85 outside the capabilities of the device.
86
87 The following sections are informative.
88
90 None.
91
93 None.
94
96 None.
97
99 None.
100
102 Section 2.5, Standard I/O Streams, ferror(), fopen(), getrlimit(),
103 putc(), puts(), setbuf(), ulimit()
104
105 The Base Definitions volume of POSIX.1‐2008, <stdio.h>
106
108 Portions of this text are reprinted and reproduced in electronic form
109 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
110 -- Portable Operating System Interface (POSIX), The Open Group Base
111 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
112 cal and Electronics Engineers, Inc and The Open Group. (This is
113 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
114 event of any discrepancy between this version and the original IEEE and
115 The Open Group Standard, the original IEEE and The Open Group Standard
116 is the referee document. The original Standard can be obtained online
117 at http://www.unix.org/online.html .
118
119 Any typographical or formatting errors that appear in this page are
120 most likely to have been introduced during the conversion of the source
121 files to man page format. To report such errors, see https://www.ker‐
122 nel.org/doc/man-pages/reporting_bugs.html .
123
124
125
126IEEE/The Open Group 2013 FPUTC(3P)