114 \fBfseek\fR(3C). If two separate processes open the same file for append, each
115 process may write freely to the file without fear of destroying output being
116 written by the other. The output from the two processes will be intermixed in
117 the file in the order in which it is written.
118 .sp
119 .LP
120 When a file is opened with update mode (\fB+\fR as the second or third
121 character in the \fImode\fR argument), both input and output may be performed
122 on the associated stream. However, output must not be directly followed by
123 input without an intervening call to \fBfflush\fR(3C) or to a file positioning
124 function ( \fBfseek\fR(3C), \fBfsetpos\fR(3C) or \fBrewind\fR(3C)), and input
125 must not be directly followed by output without an intervening call to a file
126 positioning function, unless the input operation encounters end-of-file.
127 .sp
128 .LP
129 When opened, a stream is fully buffered if and only if it can be determined not
130 to refer to an interactive device. The error and end-of-file indicators for the
131 stream are cleared.
132 .sp
133 .LP
134 If \fImode\fR begins with \fIw\fR or \fBa\fR and the file did not previously
135 exist, upon successful completion, \fBfopen()\fR function will mark for update
136 the \fBst_atime\fR, \fBst_ctime\fR and \fBst_mtime\fR fields of the file and
137 the \fBst_ctime\fR and \fBst_mtime\fR fields of the parent directory.
138 .sp
139 .LP
140 If \fImode\fR begins with \fIw\fR and the file did previously exist, upon
141 successful completion, \fBfopen()\fR will mark for update the \fBst_ctime\fR
142 and \fBst_mtime\fR fields of the file. The \fBfopen()\fR function will
143 allocate a file descriptor as \fBopen\fR(2) does.
144 .sp
145 .LP
146 Normally, 32-bit applications return an \fBEMFILE\fR error when attempting to
147 associate a stream with a file accessed by a file descriptor with a value
148 greater than 255. If the last character of \fImode\fR is \fBF\fR, 32-bit
149 applications will be allowed to associate a stream with a file accessed by a
150 file descriptor with a value greater than 255. A \fBFILE\fR pointer obtained in
151 this way must never be used by any code that might directly access fields in
152 the \fBFILE\fR structure. If the fields in the \fBFILE\fR structure are used
153 directly by 32-bit applications when the last character of mode is \fBF\fR,
154 data corruption could occur. See the USAGE section of this manual page and the
155 \fBenable_extended_FILE_stdio\fR(3C) manual page for other options for enabling
156 the extended FILE facility.
157 .sp
158 .LP
159 In 64-bit applications, the last character of \fImode\fR is silently ignored if
160 it is \fBF\fR. 64-bit applications are always allowed to associate a stream
|
114 \fBfseek\fR(3C). If two separate processes open the same file for append, each
115 process may write freely to the file without fear of destroying output being
116 written by the other. The output from the two processes will be intermixed in
117 the file in the order in which it is written.
118 .sp
119 .LP
120 When a file is opened with update mode (\fB+\fR as the second or third
121 character in the \fImode\fR argument), both input and output may be performed
122 on the associated stream. However, output must not be directly followed by
123 input without an intervening call to \fBfflush\fR(3C) or to a file positioning
124 function ( \fBfseek\fR(3C), \fBfsetpos\fR(3C) or \fBrewind\fR(3C)), and input
125 must not be directly followed by output without an intervening call to a file
126 positioning function, unless the input operation encounters end-of-file.
127 .sp
128 .LP
129 When opened, a stream is fully buffered if and only if it can be determined not
130 to refer to an interactive device. The error and end-of-file indicators for the
131 stream are cleared.
132 .sp
133 .LP
134 If \fImode\fR begins with \fBw\fR or \fBa\fR and the file did not previously
135 exist, upon successful completion, \fBfopen()\fR function will mark for update
136 the \fBst_atime\fR, \fBst_ctime\fR and \fBst_mtime\fR fields of the file and
137 the \fBst_ctime\fR and \fBst_mtime\fR fields of the parent directory.
138 .sp
139 .LP
140 If \fImode\fR begins with \fBw\fR and the file did previously exist, upon
141 successful completion, \fBfopen()\fR will mark for update the \fBst_ctime\fR
142 and \fBst_mtime\fR fields of the file. The \fBfopen()\fR function will
143 allocate a file descriptor as \fBopen\fR(2) does.
144 .sp
145 .LP
146 Normally, 32-bit applications return an \fBEMFILE\fR error when attempting to
147 associate a stream with a file accessed by a file descriptor with a value
148 greater than 255. If the last character of \fImode\fR is \fBF\fR, 32-bit
149 applications will be allowed to associate a stream with a file accessed by a
150 file descriptor with a value greater than 255. A \fBFILE\fR pointer obtained in
151 this way must never be used by any code that might directly access fields in
152 the \fBFILE\fR structure. If the fields in the \fBFILE\fR structure are used
153 directly by 32-bit applications when the last character of mode is \fBF\fR,
154 data corruption could occur. See the USAGE section of this manual page and the
155 \fBenable_extended_FILE_stdio\fR(3C) manual page for other options for enabling
156 the extended FILE facility.
157 .sp
158 .LP
159 In 64-bit applications, the last character of \fImode\fR is silently ignored if
160 it is \fBF\fR. 64-bit applications are always allowed to associate a stream
|