how can i read more than 1 char in my buffer?
- Code:
while (hPort != INVALID_HANDLE_VALUE)
{
// Wait for an event to occur for the port.
WaitCommEvent (hPort, &dwCommModemStatus;, 0);
// Re-specify the set of events to be monitored for the port.
SetCommMask (hPort, EV_RXCHAR | EV_CTS | EV_DSR | EV_RING);
if (dwCommModemStatus & EV_RXCHAR)
{
// Loop for waiting for the data.
do
{
// Read the data from the serial port.
ReadFile (hPort, &Byte;, 1, &dwBytesTransferred;, 0);
// Display the data read.
if (dwBytesTransferred == 1)
ProcessChar (Byte);
} while (dwBytesTransferred == 1);
}