Hello all,

I have an application that is receiving data over serial using QtSerialPort that is displaying data over a terminal (much like the examples in QtSerialPort if you are familiar with it). I also want to be able to save this data into a .txt file for further analysis. My problem is that I'm using QDataStream and it seems to be I am inserting extra characters somehow.

For example, data coming over the terminal, and how it's supposed to
1, 3, 2500000, 100000, 23000000

but when I'm saving to a .txt file the data is saved as:
> 1 , 3 , 2 5 0 0 0 0 0 , 1 0 0 0 0 0 , 2 3 0 0 0 0 0 0

And yes, there's an extra ">" at the beginning


Soooo here's my code. Here is to setup the save file:
Qt Code:
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3. //Savefile setup
  4. if(ui->lineEdit_savefile->text().isEmpty()) on_pushButton_Browse_clicked(); //Check to make sure the user entered a file
  5. QString fileName = ui->lineEdit_savefile->text();
  6. if(!fileName.endsWith('.txt')){
  7. fileName.append(".txt");
  8. ui->lineEdit_savefile->setText(ui->lineEdit_savefile->text().append('.txt'));
  9. }
  10. saveFile.setFileName(fileName);
  11. if(!saveFile.open(QIODevice::WriteOnly | QIODevice::Text)){
  12. QMessageBox::information(this, tr("Unable to open file"),
  13. saveFile.errorString());
  14. return;
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

Here is how I write to the file:
Qt Code:
  1. void MainWindow::saveData(const QByteArray &data){
  2. QDataStream out(&saveFile);
  3. out.setVersion(QDataStream::Qt_4_5);
  4. out << QString(data);
  5. }
To copy to clipboard, switch view to plain text mode 


And this is how the console application handles the data and prints it to the screen. It works correctly.
Qt Code:
  1. void Console::putData(const QByteArray &data)
  2. {
  3. insertPlainText(QString(data));
  4.  
  5. QScrollBar *bar = verticalScrollBar();
  6. bar->setValue(bar->maximum());
  7. }
To copy to clipboard, switch view to plain text mode 

How do I get rid of these extra characters? Thank you very much in advance for your input(s)!