QFile

 QFile

 

#include <QFile>

 

 

QFile file("in.txt");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  return;

while (!file.atEnd()) {
  QByteArray line = file.readLine();
  process_line(line);
}

 

 

QFile函数列表

typedef DecoderFn
enum FileError
enum FileHandleFlag
flags FileHandleFlags
enum FileTime
enum MemoryMapFlags
flags OpenMode
enum OpenModeFlag
enum Permission
flags Permissions
QFile()
QFile(const QString &)
QFile(QObject *)
QFile(const QString &, QObject *)
~QFile()
aboutToClose()
atEnd() const : bool
atEnd() const : bool
blockSignals(bool ) : bool
bytesAvailable() const : qint64
bytesToWrite() const : qint64
bytesWritten(qint64 )
canReadLine() const : bool
channelBytesWritten(int , qint64 )
channelReadyRead(int )
childEvent(QChildEvent *)
children() const : const QObjectList &
close()
close()
commitTransaction()
connect(const QObject *, const char *, const QObject *, const char *, Qt::ConnectionType ) : QMetaObject::Connection
connect(const QObject *, const QMetaMethod &, const QObject *, const QMetaMethod &, Qt::ConnectionType ) : QMetaObject::Connection
connect(const QObject *, const char *, const char *, Qt::ConnectionType ) const : QMetaObject::Connection
connect(const QObject *, PointerToMemberFunction , const QObject *, PointerToMemberFunction , Qt::ConnectionType ) : QMetaObject::Connection
connect(const QObject *, PointerToMemberFunction , Functor ) : QMetaObject::Connection
connect(const QObject *, PointerToMemberFunction , const QObject *, Functor , Qt::ConnectionType ) : QMetaObject::Connection
connectNotify(const QMetaMethod &)
copy(const QString &) : bool
copy(const QString &, const QString &) : bool
currentReadChannel() const : int
currentWriteChannel() const : int
customEvent(QEvent *)
d_ptr : QScopedPointer<QObjectData>
decodeName(const QByteArray &) : QString
decodeName(const char *) : QString
deleteLater()
destroyed(QObject *)
disconnect(const QObject *, const char *, const QObject *, const char *) : bool
disconnect(const QObject *, const QMetaMethod &, const QObject *, const QMetaMethod &) : bool
disconnect(const char *, const QObject *, const char *) const : bool
disconnect(const QObject *, const char *) const : bool
disconnect(const QMetaObject::Connection &) : bool
disconnect(const QObject *, PointerToMemberFunction , const QObject *, PointerToMemberFunction ) : bool
disconnectNotify(const QMetaMethod &)
dumpObjectInfo() const
dumpObjectTree() const
dynamicPropertyNames() const : QList<QByteArray>
encodeName(const QString &) : QByteArray
error() const : QFileDevice::FileError
errorString() const : QString
event(QEvent *) : bool
eventFilter(QObject *, QEvent *) : bool
exists(const QString &) : bool
exists() const : bool
fileName() const : QString
fileName() const : QString
fileTime(QFileDevice::FileTime ) const : QDateTime
findChild(const QString &, Qt::FindChildOptions ) const : T
findChildren(const QString &, Qt::FindChildOptions ) const : QList<T>
findChildren(const QRegExp &, Qt::FindChildOptions ) const : QList<T>
findChildren(const QRegularExpression &, Qt::FindChildOptions ) const : QList<T>
flush() : bool
getChar(char *) : bool
handle() const : int
inherits(const char *) const : bool
installEventFilter(QObject *)
isOpen() const : bool
isReadable() const : bool
isSequential() const : bool
isSequential() const : bool
isSignalConnected(const QMetaMethod &) const : bool
isTextModeEnabled() const : bool
isTransactionStarted() const : bool
isWidgetType() const : bool
isWindowType() const : bool
isWritable() const : bool
killTimer(int )
link(const QString &) : bool
link(const QString &, const QString &) : bool
map(qint64 , qint64 , QFileDevice::MemoryMapFlags ) : uchar *
metaObject() const : const QMetaObject *
metaObject() const : const QMetaObject *
metaObject() const : const QMetaObject *
metaObject() const : const QMetaObject *
moveToThread(QThread *)
objectName() const : QString
objectNameChanged(const QString &)
open(QIODevice::OpenMode ) : bool
open(QIODevice::OpenMode ) : bool
open(FILE *, QIODevice::OpenMode , QFileDevice::FileHandleFlags ) : bool
open(int , QIODevice::OpenMode , QFileDevice::FileHandleFlags ) : bool
openMode() const : QIODevice::OpenMode
parent() const : QObject *
peek(char *, qint64 ) : qint64
peek(qint64 ) : QByteArray
permissions() const : QFileDevice::Permissions
permissions() const : QFileDevice::Permissions
permissions(const QString &) : QFileDevice::Permissions
pos() const : qint64
pos() const : qint64
property(const char *) const : QVariant
putChar(char ) : bool
qt_metacall(QMetaObject::Call, int, void **) : int
qt_metacall(QMetaObject::Call, int, void **) : int
qt_metacall(QMetaObject::Call, int, void **) : int
qt_metacall(QMetaObject::Call, int, void **) : int
qt_metacast(const char *) : void *
qt_metacast(const char *) : void *
qt_metacast(const char *) : void *
qt_metacast(const char *) : void *
read(char *, qint64 ) : qint64
read(qint64 ) : QByteArray
readAll() : QByteArray
readChannelCount() const : int
readChannelFinished()
readData(char *, qint64 ) : qint64
readData(char *, qint64 ) : qint64
readLine(char *, qint64 ) : qint64
readLine(qint64 ) : QByteArray
readLineData(char *, qint64 ) : qint64
readLineData(char *, qint64 ) : qint64
readyRead()
receivers(const char *) const : int
remove() : bool
remove(const QString &) : bool
removeEventFilter(QObject *)
rename(const QString &) : bool
rename(const QString &, const QString &) : bool
reset() : bool
resize(qint64 ) : bool
resize(qint64 ) : bool
resize(const QString &, qint64 ) : bool
rollbackTransaction()
seek(qint64 ) : bool
seek(qint64 ) : bool
sender() const : QObject *
senderSignalIndex() const : int
setCurrentReadChannel(int )
setCurrentWriteChannel(int )
setErrorString(const QString &)
setFileName(const QString &)
setFileTime(const QDateTime &, QFileDevice::FileTime ) : bool
setObjectName(const QString &)
setOpenMode(QIODevice::OpenMode )
setParent(QObject *)
setPermissions(QFileDevice::Permissions ) : bool
setPermissions(QFileDevice::Permissions ) : bool
setPermissions(const QString &, QFileDevice::Permissions ) : bool
setProperty(const char *, const QVariant &) : bool
setTextModeEnabled(bool )
signalsBlocked() const : bool
size() const : qint64
size() const : qint64
size() const : qint64
skip(qint64 ) : qint64
startTimer(int , Qt::TimerType ) : int
startTimer(std::chrono::milliseconds , Qt::TimerType ) : int
startTransaction()
staticMetaObject : const QMetaObject
staticMetaObject : const QMetaObject
staticMetaObject : const QMetaObject
staticMetaObject : const QMetaObject
staticQtMetaObject : const QMetaObject
symLinkTarget(const QString &) : QString
symLinkTarget() const : QString
thread() const : QThread *
timerEvent(QTimerEvent *)
tr(const char *, const char *, int ) : QString
tr(const char *, const char *, int ) : QString
tr(const char *, const char *, int ) : QString
tr(const char *, const char *, int ) : QString
trUtf8(const char *, const char *, int ) : QString
trUtf8(const char *, const char *, int ) : QString
trUtf8(const char *, const char *, int ) : QString
ungetChar(char )
unmap(uchar *) : bool
unsetError()
waitForBytesWritten(int ) : bool
waitForReadyRead(int ) : bool
write(const char *, qint64 ) : qint64
write(const char *) : qint64
write(const QByteArray &) : qint64
writeChannelCount() const : int
writeData(const char *, qint64 ) : qint64
writeData(const char *, qint64 ) : qint64

 

 

 

######################

posted @ 2022-05-07 07:58  西北逍遥  阅读(317)  评论(0编辑  收藏  举报