Hello,

I want to check how many bytes are written on the port after I send an amount of data..

I connected bytesWritten signal of IODevice to a slot for viewing the amount of bytes written..

But when i print it on a textedit display, i see a value like:

-3617008641903833651

What does this mean? I was expecting something like 1024 (bytes)...

Here is the code:

Here I connected the slot to bytesWrittenSignal:
Qt Code:
  1. connect(serial, SIGNAL(QIODevice::bytesWritten(qint64)),this,SLOT(writtenBytes(qint64)));
To copy to clipboard, switch view to plain text mode 

That is the slot definition:
Qt Code:
  1. qint64 SerialPort::writtenBytes(qint64 bytes)
  2. {
  3. allWrittenBytes = bytes;
  4. return bytes;
  5. }
To copy to clipboard, switch view to plain text mode 

I printed it on QTextEdit.(I converted it to QString for compatibility)
Qt Code:
  1. qint64 writtenBytes_x;
  2. writtenBytes_x = sp->allWrittenBytes;
  3. QString writtenBytesString = QString::number(writtenBytes_x,10);
  4. textEdit->append(writtenBytesString);
To copy to clipboard, switch view to plain text mode