QtSerial bytesAvailable rejecting 0 in Data bits
-
hello Sir,
I am doing MODBUS based project and i have to manupulate with data contating ' 0 ' but when my program get ' 0 ' it terminates the further inputs ; Function
@
char String[11]={0x05,0x04,0x01,0x01,0x01,0x0A,0x71,0x89,0x00,'\0'};int avail =port->bytesAvailable(); // is also providing the value upto it contain some value;
@Here the Avail value is 8 but when String Contating 0x00
@
char String[11]={0x05,0x04,0x00,0x00,0x00,0x0A,0x71,0x89,0x00,'\0'};
@
it terminates at after 5,4 and at output I am getting only 5,4 so please provide some help;My Code is :
@
void Dialog::onReadyRead()
{if (port->bytesAvailable())
{
int avail=port->bytesAvailable();
QByteArray data = port->readAll();
for(int i=0;i<8;i++)
{
test[i]=data[i]+48;
}
ui->stringOne->setText(test);
ui->stringTwo->setNum(avail);
}
}
@ -
Hi,
Please don't post multiple threads on the same topic, you are already getting answer in "this one":http://qt-project.org/forums/viewthread/31174/