I mapped my file to memory using boost::iostreams::mapped_file_source
and declared a stream to read the file as boost::iostreams::stream <boost::iostreams::mapped_file_source> streamReader
.
It worked fine and I was able to parse the memory mapped file. I used getline
to read the entire file and stored certain offsets from the file. While performing this operation I was able to use seekg
to seek streamReader to desired position. But once the whole file is read, I cannot seek streamReader to anywhere.
streamReader.fail()
returns true. Does streamReader clears the pointer once it reaches the end of file?
Is there some way so that I can go to the desired file offset after reading the entire file?
ThankYou
I think you should call the clear()
method of the stream to reset its state.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.