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