Which class is more efficient to read the data from text file ?



  • if i want to get sub string in each line when required.



  • I would use qtextstream, I don't know which other alternatives could be more efficient...



  • [quote author="fluca1978" date="1322737551"]I would use qtextstream, I don't know which other alternatives could be more efficient...[/quote]

    how can i can access each substring separated by space in each line in that?



  • Please read the "documentation":http://doc.qt.nokia.com/4.7/qtextstream.html#details:

    bq. There are three general ways to use QTextStream when reading text files:
    Chunk by chunk, by calling readLine() or readAll().
    Word by word. QTextStream supports streaming into QStrings, QByteArrays and char* buffers. Words are delimited by space, and leading white space is automatically skipped.
    Character by character, by streaming into QChar or char types. This method is often used for convenient input handling when parsing files, independent of character encoding and end-of-line semantics. To skip white space, call skipWhiteSpace().


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.