How to store data on a "dynamic buffer" in Qt?

1k Views Asked by At

I tried QBuffer but it seems that it's not useful for me. I need something like the Buffer class in Java

Namely, I want to inject data in buffer and when I read n-size of data (from the end), this should be removed or the seek pointer should be moved in the correct position.

Context: I must send a file (line by line) through serial port. The main program injects the file and my thread which manage the connection, sends the data from buffer when is possible.

1

There are 1 best solutions below

1
On

You could use a QBuffer with a QDataStream class.

So, the QBuffer provides a QIODevice over a byte array and the QDataStream then gives the serialization functionality that you desire.