Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 6282078ae76a671f49c6af38c67b1a07 > files > 547

kdelibs-devel-2.2.2-49.2mdk.i586.rpm

<HTML>
<HEAD>
<TITLE>class KTempFile</TITLE>

<META NAME="Generator" CONTENT="KDOC ">
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff">
<TABLE WIDTH="100%" BORDER="0">
<TR>
<TD>
	<TABLE BORDER="0">
		<TR><TD valign="top" align="left" cellspacing="10">
		<h1>class KTempFile</h1>
		</TD>
		<TD valign="top" align="right" colspan="1">
 The KTempFile class creates and opens a unique file for temporary use. <small><A HREF="#longdesc">More...</A></small></TD></TR>
	</TABLE>
	<HR>
	<TABLE BORDER="0">
		<TR><TH>Definition</TH><TD><code>#include &lt;<A HREF="ktempfile_h.html">ktempfile.h</A>&gt;</code></TD></TR>
<TR><TH><A HREF="full-list-KTempFile.html">List of all Methods</A></TH></TR>
	</TABLE>
	</TD>
<TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR>
<TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR>
<TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR>
<TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR>
<TR><TD><small><A HREF="index.html">Index</A></small></TD></TR>
</TABLE></TD></TR></TABLE>
<h4>Public Methods</h4><ul><LI>&nbsp;<b><A HREF="#ref2">KTempFile</A></b> (<A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> filePrefix=QString::null, 
             <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> fileExtension=QString::null, 
             int mode = 0600 ) 
</LI>
<LI>&nbsp;<b><A HREF="#ref3">~KTempFile</A></b> () 
</LI>
<LI>void &nbsp;<b><A HREF="#ref4">setAutoDelete</A></b> (bool autoDelete) 
</LI>
<LI>int &nbsp;<b><A HREF="#ref5">status</A></b> () 
</LI>
<LI><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &nbsp;<b><A HREF="#ref6">name</A></b> () 
</LI>
<LI>int &nbsp;<b><A HREF="#ref7">handle</A></b> () 
</LI>
<LI>FILE *&nbsp;<b><A HREF="#ref8">fstream</A></b> () 
</LI>
<LI><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qtextstream.html">QTextStream</A> *&nbsp;<b><A HREF="#ref9">textStream</A></b> () 
</LI>
<LI><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qdatastream.html">QDataStream</A> *&nbsp;<b><A HREF="#ref10">dataStream</A></b> () 
</LI>
<LI><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qfile.html">QFile</A> *&nbsp;<b><A HREF="#ref11">file</A></b> () 
</LI>
<LI>void &nbsp;<b><A HREF="#ref12">unlink</A></b> () 
</LI>
<LI>bool &nbsp;<b><A HREF="#ref13">close</A></b> () 
</LI>
</ul><h4>Protected Methods</h4><ul><LI>&nbsp;<b><A HREF="#ref14">KTempFile</A></b> (bool) 
</LI>
<LI>bool &nbsp;<b><A HREF="#ref15">create</A></b> (const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &filePrefix, 
               const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &fileExtension, int mode) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref16">setError</A></b> (int error) 
</LI>
</ul><HR><H2><A NAME="longdesc">Detailed Description</A></H2><p>
 The KTempFile class creates and opens a unique file for temporary use.
</p>
<p> This is especially useful if you need to create a file in a world
 writable directory like /tmp without being vulnerable to so called
 symlink attacks.
</p>
<p> KDE applications, however, shouldn't create files in /tmp in the first 
 place but use the "tmp" resource instead. The standard KTempFile 
 constructor will do that by default.
</p>
<p> To create a temporary file that starts with a certain name
 in the "tmp" resource, one should use:
 KTempFile(locateLocal("tmp", prefix), extension);
</p>
<p> KTempFile does not create any missing directories, but locateLocal() does.
</p>
<p> See also <A HREF="KStandardDirs.html">KStandardDirs</A>
</p>
<p></p>
<A NAME="KTempFile"></A><A NAME="ref2"></A><table width="100%"><tr bgcolor="#eeeeee"><td>&nbsp;<strong>KTempFile</strong> (<A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> filePrefix=QString::null, 
             <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> fileExtension=QString::null, 
             int mode = 0600 )
<br></td><td align="right"><h3><strong>KTempFile</strong></h3></td></tr></table><p></p><p>
 Create a temporary file with the name:
  <filePrefix><some number><fileExtension>
</p>
<p> The default <code>filePrefix</code> is "$KDEHOME/tmp-$HOST/appname"
 The default <code>fileExtension</code> is ".tmp"
</p>
<p> Note that the use of 'X' is forbidden in <code>fileExtension</code>
</p>
<A NAME="~KTempFile"></A><A NAME="ref3"></A><table width="100%"><tr bgcolor="#eeeeee"><td>&nbsp;<strong>~KTempFile</strong> ()
<br></td><td align="right"><h3><strong>~KTempFile</strong></h3></td></tr></table><p></p><p>
 The destructor closes the file.
 If autoDelete is enabled the file gets unlinked as well.
</p>
<A NAME="setAutoDelete"></A><A NAME="ref4"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setAutoDelete</strong> (bool autoDelete)
<br></td><td align="right"><h3><strong>setAutoDelete</strong></h3></td></tr></table><p></p><p>
 Turn automatic deletion on or off.
 Automatic deletion is off by default.
</p>
<A NAME="status"></A><A NAME="ref5"></A><table width="100%"><tr bgcolor="#eeeeee"><td>int &nbsp;<strong>status</strong> ()
<br></td><td align="right"><h3><strong>status</strong></h3></td></tr></table><p></p><p>
 Returns the status of the file based on errno. (see errno.h) 
 0 means OK.
</p>
<p> You should check the status after object creation to check 
 whether a file could be created in the first place.
</p>
<p> You may check the status after closing the file to verify that
 the file has indeed been written correctly.
</p>
<A NAME="name"></A><A NAME="ref6"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &nbsp;<strong>name</strong> ()
<br></td><td align="right"><h3><strong>name</strong></h3></td></tr></table><p></p><p>
 The name of the file.
</p>
<A NAME="handle"></A><A NAME="ref7"></A><table width="100%"><tr bgcolor="#eeeeee"><td>int &nbsp;<strong>handle</strong> ()
<br></td><td align="right"><h3><strong>handle</strong></h3></td></tr></table><p></p><p>
 An integer file descriptor open for writing to the file 
</p>
<A NAME="fstream"></A><A NAME="ref8"></A><table width="100%"><tr bgcolor="#eeeeee"><td>FILE *&nbsp;<strong>fstream</strong> ()
<br></td><td align="right"><h3><strong>fstream</strong></h3></td></tr></table><p></p><p>
</p>
<p><b>Returns</b>: FILE* stream open for writing to the file
</p>
<A NAME="textStream"></A><A NAME="ref9"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qtextstream.html">QTextStream</A> *&nbsp;<strong>textStream</strong> ()
<br></td><td align="right"><h3><strong>textStream</strong></h3></td></tr></table><p></p><p>
</p>
<p><b>Returns</b>: QTextStream open for writing to the file
</p>
<A NAME="dataStream"></A><A NAME="ref10"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qdatastream.html">QDataStream</A> *&nbsp;<strong>dataStream</strong> ()
<br></td><td align="right"><h3><strong>dataStream</strong></h3></td></tr></table><p></p><p>
</p>
<p><b>Returns</b>: QDataStream open for writing to the file
</p>
<A NAME="file"></A><A NAME="ref11"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qfile.html">QFile</A> *&nbsp;<strong>file</strong> ()
<br></td><td align="right"><h3><strong>file</strong></h3></td></tr></table><p></p><p>
 A QFile open for writing to the file
</p>
<A NAME="unlink"></A><A NAME="ref12"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>unlink</strong> ()
<br></td><td align="right"><h3><strong>unlink</strong></h3></td></tr></table><p></p><p>
 Unlinks the file from the directory. The file is
 deleted once the last reader/writer closes it.
</p>
<A NAME="close"></A><A NAME="ref13"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool &nbsp;<strong>close</strong> ()
<br></td><td align="right"><h3><strong>close</strong></h3></td></tr></table><p></p><p>
 Closes the file.
 Returns 'true' is successfull, or 'false' if an error has occured.
 See status() for details about errors.
</p>
<A NAME="KTempFile"></A><A NAME="ref14"></A><table width="100%"><tr bgcolor="#eeeeee"><td>&nbsp;<strong>KTempFile</strong> (bool)
<br></td><td align="right"><h3><strong>KTempFile</strong></h3></td></tr></table><p> <small>[protected]</small></p><p>
 Constructor used by KSaveFile
</p>
<A NAME="create"></A><A NAME="ref15"></A><table width="100%"><tr bgcolor="#eeeeee"><td>bool &nbsp;<strong>create</strong> (const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &filePrefix, 
               const <A HREF="../../../../../../../../../usr/share/doc/qt-2.3.1/html/qstring.html">QString</A> &fileExtension, int mode)
<br></td><td align="right"><h3><strong>create</strong></h3></td></tr></table><p> <small>[protected]</small></p><p>
 Create function used internally by KTempFile and KSaveFile
</p>
<A NAME="setError"></A><A NAME="ref16"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setError</strong> (int error)
<br></td><td align="right"><h3><strong>setError</strong></h3></td></tr></table><p> <small>[protected]</small></p><HR><UL><LI><i>Author</i>: Waldo Bastian <bastian@kde.org>
 </LI><LI><i>Generated</i>: qateam on updates.mandrakesoft.com on Mon Dec 30 16:08:56 2002, using kdoc 2.0a53.</LI></UL></BODY></HTML>