How many bytes did i send?
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:
Code:
connect(serial,
SIGNAL(QIODevice::bytesWritten(qint64
)),
this,
SLOT(writtenBytes
(qint64
)));
That is the slot definition:
Code:
qint64 SerialPort::writtenBytes(qint64 bytes)
{
allWrittenBytes = bytes;
return bytes;
}
I printed it on QTextEdit.(I converted it to QString for compatibility)
Code:
qint64 writtenBytes_x;
writtenBytes_x = sp->allWrittenBytes;
textEdit->append(writtenBytesString);
Re: How many bytes did i send?
Based on the number you get I suspect you have a signed/unigned issue somewhere. Are you using QExtSerialPort?
Re: How many bytes did i send?
yes, i'm using qextserialport, what may be the problem?
Re: How many bytes did i send?
I wouldn't rely on its QIODevice interface too much.