svn: /phpdoc/en/trunk/reference/filesystem/functions/ fopen.xml
| From: | Gustavo André dos Santos Lopes | Date: | Thu, 09 Sep 2010 10:12:04 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/filesystem/functions/ fopen.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7090@lists.php.net to get a copy of this message | ||
cataphract Thu, 09 Sep 2010 10:12:04 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=303220
Log:
- Added documentation for the fopen "c" mode.
Changed paths:
U phpdoc/en/trunk/reference/filesystem/functions/fopen.xml
Modified: phpdoc/en/trunk/reference/filesystem/functions/fopen.xml
===================================================================
--- phpdoc/en/trunk/reference/filesystem/functions/fopen.xml 2010-09-09 09:10:32 UTC (rev 303219)
+++ phpdoc/en/trunk/reference/filesystem/functions/fopen.xml 2010-09-09 10:12:04 UTC (rev 303220)
@@ -158,15 +158,33 @@
<row>
<entry><literal>'x+'</literal></entry>
<entry>
- Create and open for reading and writing; place the file pointer at
- the beginning of the file. If the file already exists, the
- <function>fopen</function> call will fail by returning &false; and
- generating an error of level <constant>E_WARNING</constant>. If
- the file does not exist, attempt to create it. This is equivalent
- to specifying <literal>O_EXCL|O_CREAT</literal> flags for the
- underlying <literal>open(2)</literal> system call.
+ Create and open for reading and writing; otherwise it has the
+ same behavior as <literal>'x'</literal>.
</entry>
</row>
+ <row>
+ <entry><literal>'c'</literal></entry>
+ <entry>
+ Open the file for writing only. If the file does not exist, it is
+ created. If it exists, it is neither truncated (as opposed to
+ <literal>'w'</literal>), nor the call to this function fails (as
is
+ the case with <literal>'x'</literal>). The file pointer is
+ positioned on the beginning of the file. This may be useful if it's
+ desired to get an advisory lock (see <function>flock</function>)
+ before attempting to modify the file, as using
+ <literal>'w'</literal> could truncate the file before the lock
+ was obtained (if truncation is desired,
+ <function>ftruncate</function> can be used after the lock is
+ requested).
+ </entry>
+ </row>
+ <row>
+ <entry><literal>'c+'</literal></entry>
+ <entry>
+ Open the file for reading and writing; otherwise it has the same
+ behavior as <literal>'c'</literal>.
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>