How to Create and Use Buffers in Qt

Qt Framework includes a class called QBuffer that can be used to access a QByteArray (internal QByteArray to be precise) as if it is a file. So you can use Stream readers and writers to access data in it similar to a QFile.

Here is a brief example:

QBuffer b;;
qDebug() << b.size(); // 22;
qDebug() <<; // "http://amin";
qDebug() <<; // "o"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.