-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.4.0
-
None
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)
| For Gerrit Dashboard: QTBUG-109455 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 603072,4 | Docs: improve the example of reading from port | dev | qt/qtserialport | Status: MERGED | +2 | 0 |
| 603406,2 | Docs: improve the example of reading from port | 6.8 | qt/qtserialport | Status: MERGED | +2 | 0 |
| 603446,2 | Docs: improve the example of reading from port | tqtc/lts-6.5 | qt/tqtc-qtserialport | Status: MERGED | +2 | 0 |
| 603487,2 | Docs: improve the example of reading from port | tqtc/lts-6.2 | qt/tqtc-qtserialport | Status: MERGED | +2 | 0 |
| 603543,2 | Docs: improve the example of reading from port | tqtc/lts-5.15 | qt/tqtc-qtserialport | Status: MERGED | +2 | 0 |