Reading the same file with several different streams in Qt

為{幸葍}努か 提交于 2019-12-13 14:19:52

问题


Is it possible to read a file using multiple streams to access different portions of data in it at the same time, using Qt?


回答1:


Note that a stream (QTextStream / QDataStream) in Qt doesn't handle the position in the underlying device. A stream class is only a wrapper for easier parsing of the binary data within the device (QFile instance).

So two streams for the same device (QFile) will not work.

You can, however, have multiple devices (QFile) for the same underlying file, and each of them can then be read using another stream instance.



来源:https://stackoverflow.com/questions/11710598/reading-the-same-file-with-several-different-streams-in-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!