|
|
The KTempFile class creates and opens a unique file for temporary use.
This is especially usefull 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
|
Create a temporary file with the name: <filePrefix><some number><fileExtension>
The default filePrefix is "$KDEHOME/tmp-$HOST/appname" The default fileExtension is ".tmp"
|
The destructor closes the file. If autoDelete is enabled the file gets unlinked as well.
void |
Turn automatic deletion on or off. Automatic deletion is off by default.
int |
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.
QString |
The name of the file.
int |
An integer file descriptor open for writing to the file
FILE * |
Returns: FILE* stream open for writing to the file
QTextStream * |
Returns: QTextStream open for writing to the file
QDataStream * |
Returns: QDataStream open for writing to the file
QFile * |
A QFile open for writing to the file
void |
Unlinks the file from the directory. The file is deleted once the last reader/writer closes it.
bool |
Closes the file. Returns 'true' is successfull, or 'false' if an error has occured. See status() for details about errors.
|
[protected: ]
Constructor used by KSaveFile
bool |
[protected: ]
Create function used internally by KTempFile and KSaveFile
void |
[protected: ]