I'm calling WriteFile to send data to a modem:
BOOL writeResult = WriteFile(m_hPort, p_message, length, &numOut, NULL);
where:
m_hPort
is a validHANDLE
- p_message is an
unsigned char*
containingate0\r
- length is an
int
with a value of 5 - numOut is an
unsigned long
initialised to 0
Occasionally I'm seeing this method succeed but numOut != length
How is it possible for WriteFile to return success without sending any data?
Edit This is how I'm creating the handle:
HANDLE hPort = CreateFileA("\\\\.\\COM5", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
I've checked the return and it's not INVALID_HANDLE_VALUE
which suggests it's valid.