I have a file transfer application and I'm using a QDataStream to write data read from a QTCPSocket to a file. I thought when I wrote this that the QDataStream would remain at a fixed size but it seems that as I read from my socket and stream data out to my file, the memory of my application steadily rises, I was hoping to stream to the end of the file with each chunk and so not have to hold everything in ram.
//code a little something like this
QTCPSocket socket; //connected elsewhere
QFile f(fileName);
QDataStream ds(&f);
while(reading)
{
socket.readRawData(data);
ds.writeRawData(data);
}
Does anyone know how I can write to the file so that my memory doesn't steadily increase?