Streaming from memory mapped files in Qt

2019-07-23 12:31发布

问题:

Is there any way to create a data stream that is located at the beginning of a memory mapped file in Qt? Once i use QFile::map method, i get a uchar*. So is there any way to initialize a data stream with it? Thanks in advance!

回答1:

I've not tried it but there's a QDataStream::readRawData() function that accepts a char * and a length which you should be able to pipe that uchar * into. That'll give you your stream.