As you're storing the whole result into memory anyway for display in a text editor (so you're not expecting to load hundreds of MB of text), why not just use what Qt provides to read the entire file into a string in one call entire file into a string in one call?
It's probably more than enough optimized for general purpose usage. Displaying the entire result in the editor might also be faster than constantly appending parts.
I also see that you're using the C API for opening the file (which is never closed) and then passing it to Qt. Qt has QFile
for this, as shown in the link mentioned above.
As you're storing the whole result into memory anyway for display in a text editor (so you're not expecting to load hundreds of MB of text), why not just use what Qt provides to read the entire file into a string in one call?
It's probably more than enough optimized for general purpose usage. Displaying the entire result in the editor might also be faster than constantly appending parts.
I also see that you're using the C API for opening the file (which is never closed) and then passing it to Qt. Qt has QFile
for this, as shown in the link mentioned above.
As you're storing the whole result into memory anyway for display in a text editor (so you're not expecting to load hundreds of MB of text), why not just use what Qt provides to read the entire file into a string in one call?
It's probably more than enough optimized for general purpose usage. Displaying the entire result in the editor might also be faster than constantly appending parts.
I also see that you're using the C API for opening the file (which is never closed) and then passing it to Qt. Qt has QFile
for this, as shown in the link mentioned above.
As you're storing the whole result into memory anyway for display in a text editor (so you're not expecting to load hundreds of MB of text), why not just use what Qt provides to read the entire file into a string in one call?
It's probably more than enough optimized for general purpose usage. Displaying the entire result in the editor might also be faster than constantly appending parts.
I also see that you're using the C API for opening the file (which is never closed) and then passing it to Qt. Qt has QFile
for this, as shown in the link mentioned above.