When I try to read data from the serial port I use to get the available bytes in the port as 10 or 20 as per the reception but when I used readData function to capture the data and character buffer to store the received data I use to get only 2 bytes or 2 characters

char arr_cReadbuffer[1024];
int nBytesAvailable = m_serialportCoProcessor->bytesAvailable();
qDebug()<<"\r\n available bytes: "<<nBytesAvailable;
if ( nBytesAvailable > 0 ) {
/* read the available bytes */
int nBytesReceived = m_serialportCoProcessor->readData(arr_cReadbuffer,nBytesAvailable);
qDebug()<<"\r\n Bytes Received"<<nBytesReceived<<arr_cReadbuffer;




"available bytes: 9"

Bytes Received 9 ^MK1

Only 4 characters available at the time of reading