View Full Version : how can we search the some special markers from QFile
learning_qt
24th March 2010, 07:55
I have an object of QFile, I hope to search some special markers from this file. But I did not find any functions to do it without reading the file.
Are there some ways to do it?
Thanks
squidge
24th March 2010, 08:55
define "special markers". If you mean a specific sequence of bytes in the file, then yes, you need to read the file to find them.
learning_qt
24th March 2010, 09:44
Thanks!
If there are some better and faster ways to do it? I don't want to read the file one byte after one byte.
JohannesMunk
24th March 2010, 18:12
How should that work? You can't find anything without looking!
If you need this for performance reasons, you could create a separate 'index-file' upon writing the file or on first read, where you store the byteoffsets of your markers or sections. Then you can use QFile::seek(..) to get there fast.
HIH
Johannes
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.