Reading from a file not line-by-line
Posted
by
MadH
on Stack Overflow
See other posts from Stack Overflow
or by MadH
Published on 2009-06-26T12:52:54Z
Indexed on
2013/11/09
9:54 UTC
Read the original article
Hit count: 271
Assigning a QTextStream
to a QFile
and reading it line-by-line is easy and works fine, but I wonder if the performance can be inreased by first storing the file in memory and then processing it line-by-line.
Using FileMon from sysinternals, I've encountered that the file is read in chunks of 16KB and since the files I've to process are not that big (~2MB, but many!), loading them into memory would be a nice thing to try.
Any ideas how can I do so? QFile
is inhereted from QIODevice
, which allows me to ReadAll()
it into QByteArray
, but how to proceed then and divide it into lines?
© Stack Overflow or respective owner