php-doc-en/reference/filesystem/functions/tmpfile.xml
Jakub Vrana baf0536db2 An unique (bug #34880)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@198602 c90b9560-bf6c-de11-be94-00142212c4b1
2005-10-17 12:36:02 +00:00

74 lines
1.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.32 -->
<refentry id="function.tmpfile">
<refnamediv>
<refname>tmpfile</refname>
<refpurpose>Creates a temporary file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>tmpfile</methodname>
<void/>
</methodsynopsis>
<para>
Creates a temporary file with a unique name in read-write (w+) mode,
returning a file handle similar to the one returned by
<function>fopen</function>.
The file is automatically removed when closed (using
<function>fclose</function>), or when the script ends.
</para>
<para>
For details, consult your system documentation on the
<literal>tmpfile(3)</literal> function, as well as the
<filename>stdio.h</filename> header file.
</para>
<para>
<example>
<title><function>tmpfile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$temp = tmpfile();
fwrite($temp, "writing to tempfile");
fseek($temp, 0);
echo fread($temp, 1024);
fclose($temp); // this removes the file
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
writing to tempfile
]]>
</screen>
</example>
</para>
<para>
See also <function>tempnam</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->