Write each receiving QByteArray to end of a file
Hi, I have a serial connection that I put each coming data into a QByteArray:
Code:
connect(&SerialPort, SIGNAL(readyRead()), this, SLOT(slot_reading()));
Code:
//the slot:
void Cserial::slot_reading()
{
}
I need to save all coming data into a file. So i must gather each QByteArray::DataReading and at the end, saving all of them into a file (by pushing a QPushButtom in name of "save").
1-How could I gather all data?
and then
2-how can I save into a file?
Thanks a lot for any help
Re: Write each receiving QByteArray to end of a file
Is the button triggered file creation a "must have"?
Otherwise you could just write the incoming data directly into a file, appending each time.
Cheers,
_
Re: Write each receiving QByteArray to end of a file
Quote:
Originally Posted by
anda_skoa
Is the button triggered file creation a "must have"?
Thanks for replying. Yes a pushButton must be.
Quote:
Originally Posted by
anda_skoa
write the incoming data directly into a file, appending each time.
Working with a file makes process speed of the project too low.
Re: Write each receiving QByteArray to end of a file
Ok, then create a QBuffer and write the incoming data into that.
Get the buffer's content on button click.
Cheers,
_