I am debugging an application developed in Qt/C++ using QtCreator. My application reads from the serial port using QextSerialPort, where the serial port is connected to a Rhino Mark IV controller.
int bytesRead;
char buffer[BUFFER_SIZE];
if (_serialPort->bytesAvailable() > 0
&& (bytesRead = _serialPort->read(buffer, BUFFER_SIZE)) > 0)
{
_comBuffer.append(buffer, bytesRead);
buffer[bytesRead+1] = 0; // for debugging purposes
qDebug(buffer); // for debugging purposes
}
I am having trouble with this, because I try to read some ASCII data, but what I get into the buffer are some strange characters. For example, the ASCII code for number zero ('0') is replaced by another code that is shown by the debugger and printed by qDebug
as '°'.
In addition, I get following message in the Application Output tab: while parsing target library list: not well-formed (invalid token)
.
I wonder why I do not get the appropriate ASCII code with QextSerialPort. Is it a problem of QextSerialPort or of the Rhino Mark IV controller? I am viewing the traffic through the serial port on two monitors, and the ASCII characters are displayed correctly on the monitors. Thus, I have concluded that it is not a problema of the controller or the communication channel.
What does the message while parsing target library list: not well-formed (invalid token)
mean and why is it caused?