#include <ktempfile.h>
Public Methods | |
| KTempFile (QString filePrefix=QString::null, QString fileExtension=QString::null, int mode=0600) | |
| ~KTempFile () | |
| void | setAutoDelete (bool autoDelete) |
| int | status () const |
| QString | name () const |
| int | handle () const |
| FILE * | fstream () |
| QTextStream * | textStream () |
| QDataStream * | dataStream () |
| QFile * | file () |
| void | unlink () |
| bool | close () |
Protected Methods | |
| KTempFile (bool) | |
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.
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.
To create a temporary file that starts with a certain name in the "tmp" resource, one should use: KTempFile(locateLocal("tmp", prefix), extension);
KTempFile does not create any missing directories, but locateLocal() does.
See also KStandardDirs
Definition at line 54 of file ktempfile.h.
|
||||||||||||||||
|
Creates a temporary file with the name: <filePrefix><six letters><fileExtension>
The default
|
|
|
The destructor closes the file. If autoDelete is enabled the file gets unlinked as well. |
|
|
Constructor used by KSaveFile |
|
|
Closes the file. See status() for details about errors.
|
|
|
Returns a QDataStream for writing.
Referenced by KSaveFile::dataStream(). |
|
|
Returns a QFile.
Referenced by KSaveFile::file(). |
|
|
Returns the FILE* of the temporary file.
Referenced by KSaveFile::fstream(). |
|
|
An integer file descriptor open for writing to the file
Referenced by KSaveFile::handle(). |
|
|
Returns the full path and name of the file.
|
|
|
Turn automatic deletion on or off. Automatic deletion is off by default.
Definition at line 85 of file ktempfile.h. |
|
|
Returns the status of the file based on errno. (see errno.h) 0 means OK. You should check the status after object creation to check whether a file could be created in the first place. You may check the status after closing the file to verify that the file has indeed been written correctly.
Referenced by KSaveFile::status(). |
|
|
Returns the QTextStream for writing.
Referenced by KSaveFile::textStream(). |
|
|
Unlinks the file from the directory. The file is deleted once the last reader/writer closes it. |
1.2.18