Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QString QTextStream::readLine ( qint64  maxlen = 0  ) 

Reads one line of text from the stream, and returns it as a QString. The maximum allowed line length is set to maxlen. If the stream contains lines longer than this, then the lines will be split after maxlen characters and returned in parts.

If maxlen is 0, the lines can be of any length. A common value for maxlen is 75.

The returned line has no trailing end-of-line characters ("\\n" or "\\r\\n"), so calling QString::trimmed() is unnecessary.

If the stream has read to the end of the file, readLine() will return a null QString. For strings, or for devices that support it, you can explicitly test for the end of the stream using atEnd().

See also:
readAll(), QIODevice::readLine()

Definition at line 1583 of file qtextstream.cpp.

Referenced by Window::findFiles(), Q3MainWindow::operator>>(), QSplitter::operator>>(), Q3DockArea::operator>>(), and QDesktopServices::storageLocation().


    const QChar *readPtr;
    int length;
    if (!d->scan(&readPtr, &length, int(maxlen), QTextStreamPrivate::EndOfLine))
        return QString();

    QString tmp = QString(readPtr, length);
    return tmp;

Generated by  Doxygen 1.6.0   Back to index