Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.4.0
-
None
-
-
1
-
4fb5799ad (dev), 4929590f2 (6.8), 65694d5b1 (tqtc/lts-6.5), 1da5a9579 (tqtc/lts-6.2), b3b2155f6 (tqtc/lts-5.15)
-
Foundation Sprint 119
Description
At serial port example page there is example code. Look:
int numRead = 0, numReadTotal = 0; char buffer[50]; for (;;) { numRead = serial.read(buffer, 50); // Do whatever with the array numReadTotal += numRead; if (numRead == 0 && !serial.waitForReadyRead()) break; }
But serial.read() function returns qint64.
I suggest make
qint64 numRead = 0, numReadTotal = 0;
P.S. I agree that in real app serial.read() never returns more than int. If you think so you should use numRead=(int)serial.read(buffer, 50)