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