Qt 4.8
|
The QFile class provides an interface for reading from and writing to files. More...
#include <qfile.h>
Public Types | |
typedef QString(* | DecoderFn) (const QByteArray &localfileName) |
This is a typedef for a pointer to a function with the following signature: More... | |
typedef QByteArray(* | EncoderFn) (const QString &fileName) |
This is a typedef for a pointer to a function with the following signature: More... | |
enum | FileError { NoError = 0, ReadError = 1, WriteError = 2, FatalError = 3, ResourceError = 4, OpenError = 5, AbortError = 6, TimeOutError = 7, UnspecifiedError = 8, RemoveError = 9, RenameError = 10, PositionError = 11, ResizeError = 12, PermissionsError = 13, CopyError = 14 } |
This enum describes the errors that may be returned by the error() function. More... | |
enum | FileHandleFlag { AutoCloseHandle = 0x0001, DontCloseHandle = 0 } |
This enum is used when opening a file to specify additional options which only apply to files and not to a generic QIODevice. More... | |
enum | MemoryMapFlags { NoOptions = 0 } |
This enum describes special options that may be used by the map() function. More... | |
enum | Permission { ReadOwner = 0x4000, WriteOwner = 0x2000, ExeOwner = 0x1000, ReadUser = 0x0400, WriteUser = 0x0200, ExeUser = 0x0100, ReadGroup = 0x0040, WriteGroup = 0x0020, ExeGroup = 0x0010, ReadOther = 0x0004, WriteOther = 0x0002, ExeOther = 0x0001 } |
This enum is used by the permission() function to report the permissions and ownership of a file. More... | |
Public Types inherited from QIODevice | |
enum | OpenModeFlag { NotOpen = 0x0000, ReadOnly = 0x0001, WriteOnly = 0x0002, ReadWrite = ReadOnly | WriteOnly, Append = 0x0004, Truncate = 0x0008, Text = 0x0010, Unbuffered = 0x0020 } |
This enum is used with open() to describe the mode in which a device is opened. More... | |
Public Functions | |
bool | atEnd () const |
Returns true if the end of the file has been reached; otherwise returns false. More... | |
virtual void | close () |
Calls QFile::flush() and closes the file. More... | |
bool | copy (const QString &newName) |
Copies the file currently specified by fileName() to a file called newName. More... | |
FileError | error () const |
Returns the file error status. More... | |
bool | exists () const |
Returns true if the file specified by fileName() exists; otherwise returns false. More... | |
virtual QAbstractFileEngine * | fileEngine () const |
Returns the QIOEngine for this QFile object. More... | |
QString | fileName () const |
Returns the name set by setFileName() or to the QFile constructors. More... | |
bool | flush () |
Flushes any buffered data to the file. More... | |
int | handle () const |
Returns the file handle of the file. More... | |
bool | isSequential () const |
Returns true if the file can only be manipulated sequentially; otherwise returns false. More... | |
bool | link (const QString &newName) |
Creates a link named linkName that points to the file currently specified by fileName(). More... | |
uchar * | map (qint64 offset, qint64 size, MemoryMapFlags flags=NoOptions) |
Maps size bytes of the file into memory starting at offset. More... | |
bool | open (OpenMode flags) |
Opens the file using OpenMode mode, returning true if successful; otherwise false. More... | |
bool | open (FILE *f, OpenMode flags) |
Opens the existing file handle fh in the given mode. More... | |
bool | open (int fd, OpenMode flags) |
Opens the existing file descriptor fd in the given mode. More... | |
bool | open (FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags) |
Opens the existing file handle fh in the given mode. More... | |
bool | open (int fd, OpenMode ioFlags, FileHandleFlags handleFlags) |
Opens the existing file descriptor fd in the given mode. More... | |
Permissions | permissions () const |
Returns the complete OR-ed together combination of QFile::Permission for the file. More... | |
qint64 | pos () const |
Reimplemented Function More... | |
QFile () | |
QFile (const QString &name) | |
Constructs a new file object to represent the file with the given name. More... | |
QFile (QObject *parent) | |
Constructs a new file object with the given parent. More... | |
QFile (const QString &name, QObject *parent) | |
Constructs a new file object with the given parent to represent the file with the specified name. More... | |
QString | readLink () const |
Use symLinkTarget() instead. More... | |
bool | remove () |
Removes the file specified by fileName(). More... | |
bool | rename (const QString &newName) |
Renames the file currently specified by fileName() to newName. More... | |
bool | resize (qint64 sz) |
Sets the file size (in bytes) sz. More... | |
bool | seek (qint64 offset) |
For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred. More... | |
void | setFileName (const QString &name) |
Sets the name of the file. More... | |
bool | setPermissions (Permissions permissionSpec) |
Sets the permissions for the file to the permissions specified. More... | |
qint64 | size () const |
Returns the size of the file. More... | |
QString | symLinkTarget () const |
Returns the absolute path of the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link. More... | |
bool | unmap (uchar *address) |
Unmaps the memory address. More... | |
void | unsetError () |
Sets the file's error to QFile::NoError. More... | |
~QFile () | |
Destroys the file object, closing it if necessary. More... | |
Public Functions inherited from QIODevice | |
virtual qint64 | bytesAvailable () const |
Returns the number of bytes that are available for reading. More... | |
virtual qint64 | bytesToWrite () const |
For buffered devices, this function returns the number of bytes waiting to be written. More... | |
virtual bool | canReadLine () const |
Returns true if a complete line of data can be read from the device; otherwise returns false. More... | |
QString | errorString () const |
Returns a human-readable description of the last device error that occurred. More... | |
bool | getChar (char *c) |
Reads one character from the device and stores it in c. More... | |
bool | isOpen () const |
Returns true if the device is open; otherwise returns false. More... | |
bool | isReadable () const |
Returns true if data can be read from the device; otherwise returns false. More... | |
bool | isTextModeEnabled () const |
Returns true if the Text flag is enabled; otherwise returns false. More... | |
bool | isWritable () const |
Returns true if data can be written to the device; otherwise returns false. More... | |
OpenMode | openMode () const |
Returns the mode in which the device has been opened; i.e. More... | |
qint64 | peek (char *data, qint64 maxlen) |
Reads at most maxSize bytes from the device into data, without side effects (i. More... | |
QByteArray | peek (qint64 maxlen) |
Peeks at most maxSize bytes from the device, returning the data peeked as a QByteArray. More... | |
bool | putChar (char c) |
Writes the character c to the device. More... | |
QIODevice () | |
Constructs a QIODevice object. More... | |
QIODevice (QObject *parent) | |
Constructs a QIODevice object with the given parent. More... | |
qint64 | read (char *data, qint64 maxlen) |
Reads at most maxSize bytes from the device into data, and returns the number of bytes read. More... | |
QByteArray | read (qint64 maxlen) |
Reads at most maxSize bytes from the device, and returns the data read as a QByteArray. More... | |
QByteArray | readAll () |
Reads all available data from the device, and returns it as a QByteArray. More... | |
qint64 | readLine (char *data, qint64 maxlen) |
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes, stores the characters in data, and returns the number of bytes read. More... | |
QByteArray | readLine (qint64 maxlen=0) |
Reads a line from the device, but no more than maxSize characters, and returns the result as a QByteArray. More... | |
virtual bool | reset () |
Seeks to the start of input for random-access devices. More... | |
void | setTextModeEnabled (bool enabled) |
If enabled is true, this function sets the Text flag on the device; otherwise the Text flag is removed. More... | |
void | ungetChar (char c) |
Puts the character c back into the device, and decrements the current position unless the position is 0. More... | |
virtual bool | waitForBytesWritten (int msecs) |
For buffered devices, this function waits until a payload of buffered written data has been written to the device and the bytesWritten() signal has been emitted, or until msecs milliseconds have passed. More... | |
virtual bool | waitForReadyRead (int msecs) |
Blocks until new data is available for reading and the readyRead() signal has been emitted, or until msecs milliseconds have passed. More... | |
qint64 | write (const char *data, qint64 len) |
Writes at most maxSize bytes of data from data to the device. More... | |
qint64 | write (const char *data) |
Writes data from a zero-terminated string of 8-bit characters to the device. More... | |
qint64 | write (const QByteArray &data) |
Writes the content of byteArray to the device. More... | |
virtual | ~QIODevice () |
The destructor is virtual, and QIODevice is an abstract base class. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Static Public Functions | |
static bool | copy (const QString &fileName, const QString &newName) |
Copies the file fileName to newName. More... | |
static QString | decodeName (const QByteArray &localFileName) |
This does the reverse of QFile::encodeName() using localFileName. More... | |
static QString | decodeName (const char *localFileName) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the Unicode version of the given localFileName. More... | |
static QByteArray | encodeName (const QString &fileName) |
By default, this function converts fileName to the local 8-bit encoding determined by the user's locale. More... | |
static bool | exists (const QString &fileName) |
Returns true if the file specified by fileName exists; otherwise returns false. More... | |
static bool | link (const QString &oldname, const QString &newName) |
Creates a link named linkName that points to the file fileName. More... | |
static Permissions | permissions (const QString &filename) |
Returns the complete OR-ed together combination of QFile::Permission for fileName. More... | |
static QString | readLink (const QString &fileName) |
Use symLinkTarget() instead. More... | |
static bool | remove (const QString &fileName) |
Removes the file specified by the fileName given. More... | |
static bool | rename (const QString &oldName, const QString &newName) |
Renames the file oldName to newName. More... | |
static bool | resize (const QString &filename, qint64 sz) |
Sets fileName to size (in bytes) sz. More... | |
static void | setDecodingFunction (DecoderFn) |
Sets the function for decoding 8-bit file names. More... | |
static void | setEncodingFunction (EncoderFn) |
Sets the function for encoding Unicode file names. More... | |
static bool | setPermissions (const QString &filename, Permissions permissionSpec) |
Sets the permissions for fileName file to permissions. More... | |
static QString | symLinkTarget (const QString &fileName) |
Returns the absolute path of the file or directory referred to by the symlink (or shortcut on Windows) specified by fileName, or returns an empty string if the fileName does not correspond to a symbolic link. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Protected Functions | |
QFile (QFilePrivate &dd, QObject *parent=0) | |
qint64 | readData (char *data, qint64 maxlen) |
Reimplemented Function More... | |
qint64 | readLineData (char *data, qint64 maxlen) |
Reimplemented Function More... | |
qint64 | writeData (const char *data, qint64 len) |
Reimplemented Function More... | |
Protected Functions inherited from QIODevice | |
QIODevice (QIODevicePrivate &dd, QObject *parent=0) | |
void | setErrorString (const QString &errorString) |
Sets the human readable description of the last device error that occurred to str. More... | |
void | setOpenMode (OpenMode openMode) |
Sets the OpenMode of the device to openMode. More... | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals inherited from QIODevice | |
void | aboutToClose () |
This signal is emitted when the device is about to close. More... | |
void | bytesWritten (qint64 bytes) |
This signal is emitted every time a payload of data has been written to the device. More... | |
void | readChannelFinished () |
This signal is emitted when the input (reading) stream is closed in this device. More... | |
void | readyRead () |
This signal is emitted once every time new data is available for reading from the device. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QFile class provides an interface for reading from and writing to files.
QFile is an I/O device for reading and writing text and binary files and The Qt Resource System{resources}. A QFile may be used by itself or, more conveniently, with a QTextStream or QDataStream.
The file name is usually passed in the constructor, but it can be set at any time using setFileName(). QFile expects the file separator to be '/' regardless of operating system. The use of other separators (e.g., '\') is not supported.
You can check for a file's existence using exists(), and remove a file using remove(). (More advanced file system related operations are provided by QFileInfo and QDir.)
The file is opened with open(), closed with close(), and flushed with flush(). Data is usually read and written using QDataStream or QTextStream, but you can also call the QIODevice-inherited functions read(), readLine(), readAll(), write(). QFile also inherits getChar(), putChar(), and ungetChar(), which work one character at a time.
The size of the file is returned by size(). You can get the current file position using pos(), or move to a new file position using seek(). If you've reached the end of the file, atEnd() returns true.
The following example reads a text file line by line:
The QIODevice::Text flag passed to open() tells Qt to convert Windows-style line terminators ("\\r\\n") into C++-style terminators ("\\n"). By default, QFile assumes binary, i.e. it doesn't perform any conversion on the bytes stored in the file.
The next example uses QTextStream to read a text file line by line:
QTextStream takes care of converting the 8-bit data stored on disk into a 16-bit Unicode QString. By default, it assumes that the user system's local 8-bit encoding is used (e.g., ISO 8859-1 for most of Europe; see QTextCodec::codecForLocale() for details). This can be changed using setCodec().
To write text, we can use operator<<(), which is overloaded to take a QTextStream on the left and various data types (including QString) on the right:
QDataStream is similar, in that you can use operator<<() to write data and operator>>() to read it back. See the class documentation for details.
When you use QFile, QFileInfo, and QDir to access the file system with Qt, you can use Unicode file names. On Unix, these file names are converted to an 8-bit encoding. If you want to use standard C++ APIs ( <cstdio> or
<iostream>) or platform-specific APIs to access files instead of QFile, you can use the encodeName() and decodeName() functions to convert between Unicode file names and 8-bit file names.
On Unix, there are some special system files (e.g. in /proc
) for which size() will always return 0, yet you may still be able to read more data from such a file; the data is generated in direct response to you calling read(). In this case, however, you cannot use atEnd() to determine if there is more data to read (since atEnd() will return true for a file that claims to have size 0). Instead, you should either call readAll(), or call read() or readLine() repeatedly until no more data can be read. The next example uses QTextStream to read /proc/modules
line by line:
Unlike other QIODevice implementations, such as QTcpSocket, QFile does not emit the aboutToClose(), bytesWritten(), or readyRead() signals. This implementation detail means that QFile is not suitable for reading and writing certain types of files, such as device files on Unix platforms.
File permissions are handled differently on Linux/Mac OS X and Windows. In a non writable directory on Linux, files cannot be created. This is not always the case on Windows, where, for instance, the 'My Documents' directory usually is not writable, but it is still possible to create files in it.
QFile::DecoderFn |
This is a typedef for a pointer to a function with the following signature:
QFile::EncoderFn |
This is a typedef for a pointer to a function with the following signature:
enum QFile::FileError |
This enum describes the errors that may be returned by the error() function.
Enumerator | |
---|---|
NoError | |
ReadError | |
WriteError | |
FatalError | |
ResourceError | |
OpenError | |
AbortError | |
TimeOutError | |
UnspecifiedError | |
RemoveError | |
RenameError | |
PositionError | |
ResizeError | |
PermissionsError | |
CopyError |
Definition at line 74 of file qfile.h.
This enum is used when opening a file to specify additional options which only apply to files and not to a generic QIODevice.
Enumerator | |
---|---|
AutoCloseHandle | |
DontCloseHandle |
Definition at line 103 of file qfile.h.
This enum describes special options that may be used by the map() function.
Enumerator | |
---|---|
NoOptions |
enum QFile::Permission |
This enum is used by the permission() function to report the permissions and ownership of a file.
The values may be OR-ed together to test multiple permissions and ownership values.
Note that Qt does not by default check for permissions on NTFS file systems, as this may decrease the performance of file handling considerably. It is possible to force permission checking on NTFS by including the following code in your source:
Permission checking is then turned on and off by incrementing and decrementing qt_ntfs_permission_lookup
by 1.
Enumerator | |
---|---|
ReadOwner | |
WriteOwner | |
ExeOwner | |
ReadUser | |
WriteUser | |
ExeUser | |
ReadGroup | |
WriteGroup | |
ExeGroup | |
ReadOther | |
WriteOther | |
ExeOther |
Definition at line 95 of file qfile.h.
QFile::QFile | ( | ) |
Definition at line 417 of file qfile.cpp.
Referenced by copy(), link(), permissions(), remove(), rename(), resize(), QFilePrivate::setError(), and setPermissions().
QFile::QFile | ( | const QString & | name | ) |
Constructs a new file object to represent the file with the given name.
Definition at line 431 of file qfile.cpp.
|
explicit |
Constructs a new file object with the given parent.
Definition at line 424 of file qfile.cpp.
Constructs a new file object with the given parent to represent the file with the specified name.
Definition at line 441 of file qfile.cpp.
QFile::~QFile | ( | ) |
Destroys the file object, closing it if necessary.
Definition at line 459 of file qfile.cpp.
|
protected |
|
virtual |
Returns true if the end of the file has been reached; otherwise returns false.
For regular empty files on Unix (e.g. those in /proc
), this function returns true, since the file system reports that the size of such a file is 0. Therefore, you should not depend on atEnd() when reading data from such a file, but rather call read() until no more data can be read.
Reimplemented from QIODevice.
Definition at line 1735 of file qfile.cpp.
Referenced by copy(), QBenchmarkValgrindUtils::extractResult(), fontFile(), QHostInfo::localDomainName(), qt_parseEtcLpPrinters(), qt_parseNsswitchConf(), qt_parsePrintcap(), qt_parsePrintersConf(), and QCoreApplicationData::~QCoreApplicationData().
|
virtual |
Calls QFile::flush() and closes the file.
Errors from flush are ignored.
Reimplemented from QIODevice.
Definition at line 1680 of file qfile.cpp.
Referenced by QNetworkManagerEngine::bytesReceived(), QConnmanEngine::bytesReceived(), QNetworkManagerEngine::bytesWritten(), QConnmanEngine::bytesWritten(), QUnixPrintWidgetPrivate::checkFields(), QNetworkAccessFileBackend::closeDownstreamChannel(), QMacPasteboardMimeVCard::convertFromMime(), copy(), QTemporaryFile::createLocalFile(), QNetworkDiskCache::data(), QGraphicsAnchorLayoutPrivate::dumpGraph(), QPdfEnginePrivate::embedFont(), QtopiaPrintEngine::end(), QZipReader::extractAll(), QNetworkDiskCache::fileMetaData(), fontPath(), QDirectFBPixmapData::fromFile(), QGLPixmapData::fromFile(), QTransportAuthPrivate::getClientKey(), QScriptEngine::importExtension(), QAxScriptManager::load(), QTextBrowser::loadResource(), QTextDocument::loadResource(), QPictureIO::pictureFormat(), qt_parse_pattern(), QPictureIO::read(), registerFont(), remove(), rename(), setFileName(), QSslSocketBackendPrivate::startHandshake(), QNetworkAccessFileBackend::uploadReadyReadSlot(), QPictureIO::write(), QCoreApplicationData::~QCoreApplicationData(), ~QFile(), and QTemporaryFile::~QTemporaryFile().
bool QFile::copy | ( | const QString & | newName | ) |
Copies the file currently specified by fileName() to a file called newName.
Returns true if successful; otherwise returns false.
Note that if a file with the name newName already exists, copy() returns false (i.e. QFile will not overwrite it).
The source file is closed before it is copied.
Definition at line 926 of file qfile.cpp.
Referenced by QDragManager::drag(), QDirModel::dropMimeData(), and QFileSystemModel::dropMimeData().
Copies the file fileName to newName.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
If a file with the name newName already exists, copy() returns false (i.e., QFile will not overwrite it).
Definition at line 1031 of file qfile.cpp.
|
static |
This does the reverse of QFile::encodeName() using localFileName.
Definition at line 552 of file qfile.cpp.
Referenced by QCoreApplication::applicationFilePath(), QFontEngineQPF::cleanUpAfterClientCrash(), QWSServerPrivate::cleanupFonts(), QZipReader::extractAll(), QFileSystemEngine::getLinkTarget(), QFileSystemEngine::homePath(), QGuiPlatformPlugin::iconThemeSearchPaths(), initDefaultPaths(), loadSingleEngine(), QHostInfo::localDomainName(), QFontEngineQPF::QFontEngineQPF(), QFileSystemEntry::resolveFilePath(), QFileSystemEngine::resolveGroupName(), QFileSystemEngine::resolveUserName(), and QFileSystemEngine::tempPath().
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the Unicode version of the given localFileName.
See encodeName() for details.
Definition at line 127 of file qfile.h.
|
static |
By default, this function converts fileName to the local 8-bit encoding determined by the user's locale.
This is sufficient for file names that the user chooses. File names hard-coded into the application should only use 7-bit ASCII filename characters.
Definition at line 528 of file qfile.cpp.
Referenced by QProcessPrivate::_q_notified(), QInotifyFileSystemWatcherEngine::addPaths(), QKqueueFileSystemWatcherEngine::addPaths(), QZipWriter::addSymLink(), QSharedMemoryPrivate::attach(), QSystemSemaphorePrivate::cleanHandle(), QFontEngineQPF::cleanUpAfterClientCrash(), QSharedMemoryPrivate::create(), QProcessPrivate::createChannel(), QFileSystemEngine::createDirectory(), QSharedMemoryPrivate::createUnixKeyFile(), QSharedMemoryPrivate::detach(), QTranslatorPrivate::do_load(), QFileSystemEngine::getLinkTarget(), QSystemSemaphorePrivate::handle(), QSharedMemoryPrivate::handle(), initializeDb(), QLibraryPrivate::isPlugin(), QLibraryPrivate::load_sys(), QFileDialogPrivate::maxNameLength(), QSQLite2Driver::open(), QWSSoundServerPrivate::openFile(), QBasicUnixFontDatabase::populateFontDatabase(), QPlatformFontDatabase::populateFontDatabase(), QFontEngineQPA::QFontEngineQPA(), QFontEngineQPF::QFontEngineQPF(), QFontEngineQPF1::QFontEngineQPF1(), qt_parse_pattern(), registerFont(), QDynamicFileResourceRoot::registerSelf(), QFileSystemEngine::removeDirectory(), QFileSystemEntry::resolveNativeFilePath(), QPluginLoader::setFileName(), QProcessPrivate::startDetached(), and QProcessPrivate::startProcess().
QFile::FileError QFile::error | ( | ) | const |
Returns the file error status.
The I/O device status returns an error code. For example, if open() returns false, or a read/write operation returns -1, this function can be called to find out the reason why the operation failed.
Definition at line 1984 of file qfile.cpp.
Referenced by copy(), QIODevice::errorString(), fontPath(), QPdfBaseEngine::newPage(), QZipReader::QZipReader(), QZipWriter::QZipWriter(), QNetworkAccessFileBackend::readMoreFromFile(), remove(), rename(), and QNetworkDiskCachePrivate::storeItem().
bool QFile::exists | ( | ) | const |
Returns true if the file specified by fileName() exists; otherwise returns false.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 626 of file qfile.cpp.
Referenced by QFileDialogPrivate::_q_createDirectory(), QDeclarativeImportDatabase::addImportPath(), QDeclarativeImportDatabase::addPluginPath(), QCoreApplicationPrivate::appendApplicationPathToLibraryPaths(), QNetworkManagerEngine::bytesReceived(), QConnmanEngine::bytesReceived(), QNetworkManagerEngine::bytesWritten(), QConnmanEngine::bytesWritten(), QMacPasteboardMimeVCard::convertFromMime(), copy(), QSharedMemoryPrivate::createUnixKeyFile(), QZipWriter::exists(), QZipReader::exists(), QDir::exists(), QZipReader::extractAll(), QLibraryInfoPrivate::findConfiguration(), fontPath(), QDirectFBPixmapData::fromFile(), QDirectFbBlitterPlatformPixmap::fromFile(), QTransportAuthPrivate::getClientKey(), QGtkStylePrivate::getThemeName(), QSharedMemoryPrivate::handle(), QAxBase::initialize(), initializeDb(), isDirPath(), launchWebBrowser(), QCoreApplication::libraryPaths(), QLibraryPrivate::load_sys(), QFontDatabasePrivate::loadFromCache(), loadSingleEngine(), QNetworkAccessFileBackend::open(), QBasicUnixFontDatabase::populateFontDatabase(), QPlatformFontDatabase::populateFontDatabase(), QIconTheme::QIconTheme(), qmlsqldatabase_open_sync(), QNetworkReplyFileImpl::QNetworkReplyFileImpl(), QDynamicFileResourceRoot::registerSelf(), rename(), QDir::rename(), QNetworkDiskCachePrivate::storeItem(), QConfFileSettingsPrivate::syncConfFile(), QFileDialogPrivate::typedFiles(), and QAxFactory::validateLicenseKey().
|
static |
Returns true if the file specified by fileName exists; otherwise returns false.
Definition at line 639 of file qfile.cpp.
|
virtual |
Returns the QIOEngine for this QFile object.
Reimplemented in QTemporaryFile.
Definition at line 1965 of file qfile.cpp.
Referenced by QFontDatabase::addApplicationFont(), copy(), QTemporaryFile::createLocalFile(), exists(), fileName(), QFreetypeFace::getFace(), link(), map(), open(), permissions(), readLink(), remove(), rename(), resize(), setPermissions(), size(), and unmap().
QString QFile::fileName | ( | ) | const |
Returns the name set by setFileName() or to the QFile constructors.
Definition at line 470 of file qfile.cpp.
Referenced by __fileOpen(), QMacPasteboardMimeVCard::convertFromMime(), QGraphicsAnchorLayoutPrivate::dumpGraph(), encodeName(), QTextDocumentWriter::fileName(), QImageWriter::fileName(), QImageReader::fileName(), QImageReaderPrivate::initHandler(), QFontDatabasePrivate::loadFromCache(), QTemporaryFile::open(), open(), QIconTheme::QIconTheme(), QIODevice::QIODevice(), QNetworkReplyFileImpl::QNetworkReplyFileImpl(), QCacheItem::read(), registerFont(), QFileInfo::setFile(), setFileName(), and QConfFileSettingsPrivate::syncConfFile().
bool QFile::flush | ( | ) |
Flushes any buffered data to the file.
Returns true if successful; otherwise returns false.
Definition at line 1645 of file qfile.cpp.
Referenced by close(), QTextStreamPrivate::flushWriteBuffer(), registerFont(), QNetworkAccessFileBackend::uploadReadyReadSlot(), and writeData().
int QFile::handle | ( | ) | const |
Returns the file handle of the file.
This is a small positive integer, suitable for use with C library functions such as fdopen() and fcntl(). On systems that use file descriptors for sockets (i.e. Unix systems, but not Windows) the handle can be used with QSocketNotifier as well.
If the file is not open, or there is an error, handle() returns -1.
This function is not supported on Windows CE.
On Symbian, this function returns -1 if the file was opened normally, as Symbian OS native file handles do not fit in an int, and are incompatible with C library functions that the handle would be used for. If the file was opened using the overloads that take an open C library file handle / file descriptor, then this function returns that same handle.
Definition at line 1419 of file qfile.cpp.
Referenced by QTextStreamPrivate::fillReadBuffer(), QPatternist::ColorOutputPrivate::isColoringPossible(), and QConfFileSettingsPrivate::syncConfFile().
|
virtual |
Returns true if the file can only be manipulated sequentially; otherwise returns false.
Most files support random-access, but some special files may not.
Reimplemented from QIODevice.
Definition at line 1044 of file qfile.cpp.
Referenced by QFilePrivate::putCharHelper(), and rename().
bool QFile::link | ( | const QString & | linkName | ) |
Creates a link named linkName that points to the file currently specified by fileName().
What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.
This function will not overwrite an already existing entity in the file system; in this case, link()
will return false and set QFile::error() to return QFile::RenameError.
.lnk
file extension.Definition at line 877 of file qfile.cpp.
Referenced by QDirModel::dropMimeData(), QFileSystemModel::dropMimeData(), and QZipReader::extractAll().
Creates a link named linkName that points to the file fileName.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.
uchar * QFile::map | ( | qint64 | offset, |
qint64 | size, | ||
MemoryMapFlags | flags = NoOptions |
||
) |
Maps size bytes of the file into memory starting at offset.
Any mapping options can be passed through flags.
Returns a pointer to the memory or 0 if there is an error.
Definition at line 1460 of file qfile.cpp.
Referenced by QNetworkDiskCache::data(), and qt_parse_pattern().
|
virtual |
Opens the file using OpenMode mode, returning true if successful; otherwise false.
The mode must be QIODevice::ReadOnly, QIODevice::WriteOnly, or QIODevice::ReadWrite. It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.
Reimplemented from QIODevice.
Reimplemented in QTemporaryFile.
Definition at line 1064 of file qfile.cpp.
Referenced by __fileOpen(), QFontDatabase::addApplicationFont(), QTransportAuth::authorizeRequest(), QNetworkManagerEngine::bytesReceived(), QConnmanEngine::bytesReceived(), QNetworkManagerEngine::bytesWritten(), QConnmanEngine::bytesWritten(), QUnixPrintWidgetPrivate::checkFields(), QPatternist::ColorOutputPrivate::ColorOutputPrivate(), compileSource(), QGLShader::compileSourceFile(), QMacPasteboardMimeVCard::convertFromMime(), copy(), QTemporaryFile::createLocalFile(), createPixmapDataSync(), QUuid::createUuid(), QNetworkDiskCache::data(), QTranslatorPrivate::do_load(), QGraphicsAnchorLayoutPrivate::dumpGraph(), DumpIDL(), dumpOutput(), QPdfEnginePrivate::embedFont(), QtopiaPrintEngine::end(), QZipReader::extractAll(), QBenchmarkValgrindUtils::extractResult(), QNetworkDiskCache::fileMetaData(), fontFile(), fontPath(), QDirectFBPixmapData::fromFile(), QGLPixmapData::fromFile(), QSslCertificate::fromPath(), QFreetypeFace::getFace(), QGtkStylePrivate::getThemeName(), QImageReader::imageFormat(), QScriptEngine::importExtension(), QDeclarativeInclude::include(), QCss::Parser::init(), QImageReaderPrivate::initHandler(), initializeDb(), QConfFile::isWritable(), launchWebBrowser(), QPicture::load(), QSvgTinyDocument::load(), QDeclarativeBorderImage::load(), QDeclarativeDataLoader::load(), QAxScriptManager::load(), QFontDatabasePrivate::loadFromCache(), QRawFont::loadFromFile(), QWSKbPrivate::loadKeymap(), QTextBrowser::loadResource(), QTextDocument::loadResource(), QScriptDebuggerConsolePrivate::loadScriptedCommands(), QHostInfo::localDomainName(), FAREnforcer::logAuthAttempt(), QNetworkAccessFileBackend::open(), QTemporaryFile::open(), open(), QFileOpenEvent::openFile(), QPdfBaseEnginePrivate::openPrintDevice(), operator<<(), QDeclarativeDirParser::parse(), QPatternist::XsdSchemaParser::parseImport(), QPictureIO::pictureFormat(), QDeclarativePixmapReader::processJob(), QDeclarativeWorkerScriptEnginePrivate::processLoad(), QNetworkReplyFileImpl::QNetworkReplyFileImpl(), qt_getDefaultFromHomePrinters(), qt_getLprPrinters(), qt_parse_pattern(), qt_parseEtcLpPrinters(), qt_parseNsswitchConf(), qt_parsePrintcap(), qt_parsePrintersConf(), qt_parseQconfig(), QTextStream::QTextStream(), QZipReader::QZipReader(), QZipWriter::QZipWriter(), QPictureIO::read(), QWSCalibratedMouseHandler::readCalibration(), readConf(), readSourceFile(), registerFont(), QDynamicFileResourceRoot::registerSelf(), rename(), runningUnderDebugger(), QPicture::save(), QWaylandSelection::send(), QSslSocket::setLocalCertificate(), QSslSocket::setPrivateKey(), QTransportAuth::setProcessKey(), QSslSocketBackendPrivate::startHandshake(), QConfFileSettingsPrivate::syncConfFile(), QDeclarativeInclude::worker_include(), QSvgIconEngine::write(), QPictureIO::write(), QWSCalibratedMouseHandler::writeCalibration(), writeIncludeFile(), QCoreApplicationData::~QCoreApplicationData(), and QTraceWindowSurface::~QTraceWindowSurface().
bool QFile::open | ( | FILE * | fh, |
OpenMode | mode | ||
) |
Opens the existing file handle fh in the given mode.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
Example:
When a QFile is opened using this function, close() does not actually close the file, but only flushes it.
Warning:
stdin
, stdout
, or stderr
, you may not be able to seek(). size() returns 0
in those cases. See QIODevice::isSequential() for more information. Note for the Windows Platform
fh must be opened in binary mode (i.e., the mode string must contain 'b', as in "rb" or "wb") when accessing files and other random-access devices. Qt will translate the end-of-line characters if you pass QIODevice::Text to mode. Sequential devices, such as stdin and stdout, are unaffected by this limitation.
You need to enable support for console applications in order to use the stdin, stdout and stderr streams at the console. To do this, add the following declaration to your application's project file:
Definition at line 1152 of file qfile.cpp.
bool QFile::open | ( | int | fd, |
OpenMode | mode | ||
) |
Opens the existing file descriptor fd in the given mode.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
When a QFile is opened using this function, close() does not actually close the file.
The QFile that is opened using this function is automatically set to be in raw mode; this means that the file input/output functions are slow. If you run into performance issues, you should try to use one of the other open functions.
stdin
), 1 (stdout
), or 2 (stderr
), you may not be able to seek(). In those cases, size() returns 0
. See QIODevice::isSequential() for more information.0
.Definition at line 1270 of file qfile.cpp.
bool QFile::open | ( | FILE * | fh, |
OpenMode | mode, | ||
FileHandleFlags | handleFlags | ||
) |
Opens the existing file handle fh in the given mode.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
Example:
When a QFile is opened using this function, behaviour of close() is controlled by the AutoCloseHandle flag. If AutoCloseHandle is specified, and this function succeeds, then calling close() closes the adopted handle. Otherwise, close() does not actually close the file, but only flushes it.
Warning:
stdin
, stdout
, or stderr
, you may not be able to seek(). size() returns 0
in those cases. See QIODevice::isSequential() for more information. Note for the Windows Platform
fh must be opened in binary mode (i.e., the mode string must contain 'b', as in "rb" or "wb") when accessing files and other random-access devices. Qt will translate the end-of-line characters if you pass QIODevice::Text to mode. Sequential devices, such as stdin and stdout, are unaffected by this limitation.
You need to enable support for console applications in order to use the stdin, stdout and stderr streams at the console. To do this, add the following declaration to your application's project file:
Definition at line 1203 of file qfile.cpp.
bool QFile::open | ( | int | fd, |
OpenMode | mode, | ||
FileHandleFlags | handleFlags | ||
) |
Opens the existing file descriptor fd in the given mode.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
When a QFile is opened using this function, behaviour of close() is controlled by the handleFlags argument. If AutoCloseHandle is specified, and this function succeeds, then calling close() closes the adopted handle. Otherwise, close() does not actually close the file, but only flushes it.
The QFile that is opened using this function is automatically set to be in raw mode; this means that the file input/output functions are slow. If you run into performance issues, you should try to use one of the other open functions.
stdin
), 1 (stdout
), or 2 (stderr
), you may not be able to seek(). In those cases, size() returns 0
. See QIODevice::isSequential() for more information.0
.Definition at line 1308 of file qfile.cpp.
QFile::Permissions QFile::permissions | ( | ) | const |
Returns the complete OR-ed together combination of QFile::Permission for the file.
Definition at line 1574 of file qfile.cpp.
Referenced by copy(), rename(), and QConfFileSettingsPrivate::syncConfFile().
|
static |
Returns the complete OR-ed together combination of QFile::Permission for fileName.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1591 of file qfile.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QIODevice.
Definition at line 1720 of file qfile.cpp.
Referenced by atEnd(), QTemporaryFile::createLocalFile(), QNetworkDiskCache::data(), open(), and QFilePrivate::putCharHelper().
Reimplemented Function
Implements QIODevice.
Definition at line 1839 of file qfile.cpp.
Reimplemented Function
Reimplemented from QIODevice.
Definition at line 1812 of file qfile.cpp.
QString QFile::readLink | ( | ) | const |
Use symLinkTarget() instead.
Definition at line 671 of file qfile.cpp.
Use symLinkTarget() instead.
Definition at line 700 of file qfile.cpp.
bool QFile::remove | ( | ) |
Removes the file specified by fileName().
Returns true if successful; otherwise returns false.
The file is closed before it is removed.
Definition at line 715 of file qfile.cpp.
Referenced by QUnixPrintWidgetPrivate::checkFields(), QSystemSemaphorePrivate::cleanHandle(), QBenchmarkValgrindUtils::cleanup(), QFontEngineQPF::cleanUpAfterClientCrash(), QWSServerPrivate::cleanupFonts(), QPdfBaseEnginePrivate::closePrintDevice(), QSharedMemoryPrivate::create(), QSharedMemoryPrivate::detach(), QDirModel::dropMimeData(), DumpIDL(), QNetworkDiskCache::expire(), initializeDb(), QTransportAuth::isDiscoveryMode(), registerFont(), QFileSystemModel::remove(), QDir::remove(), QNetworkDiskCachePrivate::removeFile(), rename(), and QNetworkDiskCachePrivate::storeItem().
|
static |
Removes the file specified by the fileName given.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
bool QFile::rename | ( | const QString & | newName | ) |
Renames the file currently specified by fileName() to newName.
Returns true if successful; otherwise returns false.
If a file with the name newName already exists, rename() returns false (i.e., QFile will not overwrite it).
The file is closed before it is renamed.
Definition at line 766 of file qfile.cpp.
Referenced by QDragManager::drag(), QFileSystemModel::dropMimeData(), initializeDb(), QDir::rename(), and QNetworkDiskCachePrivate::storeItem().
Renames the file oldName to newName.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if successful; otherwise returns false.
If a file with the name newName already exists, rename() returns false (i.e., QFile will not overwrite it).
bool QFile::resize | ( | qint64 | sz | ) |
Sets the file size (in bytes) sz.
Returns true if the file if the resize succeeds; false otherwise. If sz is larger than the file currently is the new bytes will be set to 0, if sz is smaller the file is simply truncated.
Definition at line 1528 of file qfile.cpp.
Referenced by QFSFileEnginePrivate::longFileName(), and QConfFileSettingsPrivate::syncConfFile().
Sets fileName to size (in bytes) sz.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if the file if the resize succeeds; false otherwise. If sz is larger than fileName currently is the new bytes will be set to 0, if sz is smaller the file is simply truncated.
|
virtual |
For random-access devices, this function sets the current position to pos, returning true on success, or false if an error occurred.
For sequential devices, the default behavior is to do nothing and return false.
Seeking beyond the end of a file: If the position is beyond the end of a file, then seek() shall not immediately extend the file. If a write is performed at this position, then the file shall be extended. The content of the file between the previous end of file and the newly written data is UNDEFINED and varies between platforms and file systems.
Reimplemented from QIODevice.
Definition at line 1784 of file qfile.cpp.
Referenced by QTemporaryFile::createLocalFile(), QTransportAuthPrivate::getClientKey(), open(), QFilePrivate::putCharHelper(), QPictureIO::read(), resize(), and QConfFileSettingsPrivate::syncConfFile().
|
static |
Sets the function for decoding 8-bit file names.
The default uses the locale-specific 8-bit encoding.
Definition at line 606 of file qfile.cpp.
|
static |
Sets the function for encoding Unicode file names.
The default encodes in the locale-specific 8-bit encoding.
Definition at line 572 of file qfile.cpp.
void QFile::setFileName | ( | const QString & | name | ) |
Sets the name of the file.
The name can have no path, a relative path, or an absolute path.
Do not call this function if the file has already been opened.
If the file name has no path or a relative path, the path used will be the application's current directory path at the time of the open() call.
Example:
Note that the directory separator "/" works for all operating systems supported by Qt.
Definition at line 494 of file qfile.cpp.
Referenced by QMacPasteboardMimeVCard::convertFromMime(), fontPath(), QImageReaderPrivate::initHandler(), QHostInfo::localDomainName(), QNetworkAccessFileBackend::open(), QFileOpenEvent::openFile(), QIconTheme::QIconTheme(), QNetworkReplyFileImpl::QNetworkReplyFileImpl(), QPictureIO::read(), rename(), and QPictureIO::write().
bool QFile::setPermissions | ( | Permissions | permissions | ) |
Sets the permissions for the file to the permissions specified.
Returns true if successful, or false if the permissions cannot be modified.
Definition at line 1605 of file qfile.cpp.
Referenced by copy(), QZipReader::extractAll(), rename(), and QConfFileSettingsPrivate::syncConfFile().
|
static |
Sets the permissions for fileName file to permissions.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1626 of file qfile.cpp.
|
virtual |
Returns the size of the file.
For regular empty files on Unix (e.g. those in /proc
), this function returns 0; the contents of such a file are generated on demand in response to you calling read().
Reimplemented from QIODevice.
Definition at line 1707 of file qfile.cpp.
Referenced by copy(), QNetworkDiskCache::data(), QTranslatorPrivate::do_load(), QNetworkDiskCache::expire(), flush(), open(), qt_parse_pattern(), QDynamicFileResourceRoot::registerSelf(), QCacheItem::size(), and QNetworkDiskCachePrivate::storeItem().
|
inline |
Returns the absolute path of the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link.
This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.
Definition at line 137 of file qfile.h.
Returns the absolute path of the file or directory referred to by the symlink (or shortcut on Windows) specified by fileName, or returns an empty string if the fileName does not correspond to a symbolic link.
This name may not represent an existing file; it is only a string. QFile::exists() returns true if the symlink points to an existing file.
Definition at line 138 of file qfile.h.
bool QFile::unmap | ( | uchar * | address | ) |
Unmaps the memory address.
Returns true if the unmap succeeds; false otherwise.
Definition at line 1485 of file qfile.cpp.
void QFile::unsetError | ( | ) |
Sets the file's error to QFile::NoError.
Definition at line 1996 of file qfile.cpp.
Referenced by close(), copy(), QIODevice::errorString(), link(), map(), open(), readData(), remove(), rename(), resize(), seek(), setPermissions(), unmap(), and writeData().
Reimplemented Function
Implements QIODevice.
Definition at line 1923 of file qfile.cpp.