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
12 fputc - put a byte on a stream
13
15 #include <stdio.h>
16
17 int fputc(int c, FILE *stream);
18
19
21 The fputc() function shall write the byte specified by c (converted to
22 an unsigned char) to the output stream pointed to by stream, at the
23 position indicated by the associated file-position indicator for the
24 stream (if defined), and shall advance the indicator appropriately. If
25 the file cannot support positioning requests, or if the stream was
26 opened with append mode, the byte shall be appended to the output
27 stream.
28
29 The st_ctime and st_mtime fields of the file shall be marked for update
30 between the successful execution of fputc() and the next successful
31 completion of a call to fflush() or fclose() on the same stream or a
32 call to exit() or abort().
33
35 Upon successful completion, fputc() shall return the value it has writ‐
36 ten. Otherwise, it shall return EOF, the error indicator for the stream
37 shall be set, and errno shall be set to indicate the error.
38
40 The fputc() function shall fail if either the stream is unbuffered or
41 the stream's buffer needs to be flushed, and:
42
43 EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying
44 stream and the process would be delayed in the write operation.
45
46 EBADF The file descriptor underlying stream is not a valid file
47 descriptor open for writing.
48
49 EFBIG An attempt was made to write to a file that exceeds the maximum
50 file size.
51
52 EFBIG An attempt was made to write to a file that exceeds the process'
53 file size limit.
54
55 EFBIG The file is a regular file and an attempt was made to write at
56 or beyond the offset maximum.
57
58 EINTR The write operation was terminated due to the receipt of a sig‐
59 nal, and no data was transferred.
60
61 EIO A physical I/O error has occurred, or the process is a member of
62 a background process group attempting to write to its control‐
63 ling terminal, TOSTOP is set, the process is neither ignoring
64 nor blocking SIGTTOU, and the process group of the process is
65 orphaned. This error may also be returned under implementation-
66 defined conditions.
67
68 ENOSPC There was no free space remaining on the device containing the
69 file.
70
71 EPIPE An attempt is made to write to a pipe or FIFO that is not open
72 for reading by any process. A SIGPIPE signal shall also be sent
73 to the thread.
74
75
76 The fputc() function may fail if:
77
78 ENOMEM Insufficient storage space is available.
79
80 ENXIO A request was made of a nonexistent device, or the request was
81 outside the capabilities of the device.
82
83
84 The following sections are informative.
85
87 None.
88
90 None.
91
93 None.
94
96 None.
97
99 ferror(), fopen(), getrlimit(), putc(), puts(), setbuf(), ulimit(), the
100 Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
101
103 Portions of this text are reprinted and reproduced in electronic form
104 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
105 -- Portable Operating System Interface (POSIX), The Open Group Base
106 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
107 Electrical and Electronics Engineers, Inc and The Open Group. In the
108 event of any discrepancy between this version and the original IEEE and
109 The Open Group Standard, the original IEEE and The Open Group Standard
110 is the referee document. The original Standard can be obtained online
111 at http://www.opengroup.org/unix/online.html .
112
113
114
115IEEE/The Open Group 2003 FPUTC(3P)