2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 07:05:15 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.tmpfile">
|
2007-02-03 08:13:44 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>tmpfile</refname>
|
|
|
|
<refpurpose>Creates a temporary file</refpurpose>
|
|
|
|
</refnamediv>
|
2007-06-16 01:17:14 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-02-03 08:13:44 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>resource</type><methodname>tmpfile</methodname>
|
|
|
|
<void/>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-06-16 01:17:14 +00:00
|
|
|
Creates a temporary file with a unique name in read-write (w+) mode and
|
|
|
|
returns a file handle .
|
|
|
|
</para>
|
|
|
|
<para>
|
2007-02-03 08:13:44 +00:00
|
|
|
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>
|
2007-06-16 01:17:14 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns a file handle, similar to the one returned by
|
2009-11-09 10:26:08 +00:00
|
|
|
<function>fopen</function>, for the new file&return.falseforfailure;.
|
2007-06-16 01:17:14 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-02-03 08:13:44 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>tmpfile</function> example</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-05-30 20:43:26 +00:00
|
|
|
<?php
|
2002-04-15 00:12:54 +00:00
|
|
|
$temp = tmpfile();
|
|
|
|
fwrite($temp, "writing to tempfile");
|
2004-10-23 03:33:14 +00:00
|
|
|
fseek($temp, 0);
|
|
|
|
echo fread($temp, 1024);
|
2002-04-15 00:12:54 +00:00
|
|
|
fclose($temp); // this removes the file
|
2003-05-30 20:43:26 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2007-02-03 08:13:44 +00:00
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
2004-10-23 03:33:14 +00:00
|
|
|
<![CDATA[
|
|
|
|
writing to tempfile
|
|
|
|
]]>
|
2007-02-03 08:13:44 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-06-16 01:17:14 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-02-03 08:13:44 +00:00
|
|
|
<para>
|
2007-06-16 01:17:14 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>tempnam</function></member>
|
|
|
|
<member><function>sys_get_temp_dir</function></member>
|
|
|
|
</simplelist>
|
2007-02-03 08:13:44 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-06-16 01:17:14 +00:00
|
|
|
|
2007-02-03 08:13:44 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|