Re: New Essay: Serial Ports
Ok but I have other problem
////////////Joe Newcomer's code
BOOL ok = ::ReadFile(parms->hCom, buffer, MAX_BUFFER_SIZE - 1,
&bytesRead, &ovl);
if(!ok)
{ /* error */
DWORD err = ::GetLastError();
if(err != ERROR_IO_PENDING)
{ /* read error */
shutdown = err;
running = FALSE;
continue;
} /* read error */
// otherwise, it is ERROR_IO_PENDING
DWORD result = ::WaitForMultipleObjects(2, waiters, FALSE,
INFINITE);
switch(result)
{ /* wait */
case WAIT_OBJECT_0: // shutdown
::CancelIo(parms->hCom);
shutdown = ERROR_SUCCESS; // clean shutdown
running = FALSE;
continue;
case WAIT_OBJECT_0 + 1: // I/O complete
ok = ::GetOverlappedResult(parms->hCom, &ovl,
&bytesRead, TRUE);
if(!ok)
{ /* GetOverlappedResult failed */
DWORD err = ::GetLastError();
running = FALSE;
continue;
} /* GetOverlappedResult failed */
default:
{ /* trouble */
shutdown = ::GetLastError();
-----------> ASSERT(FALSE); // failure <
------------------this line
running = FALSE;
continue;
} /* trouble */
} /* wait */
} /* error */
/////////////end code
In line which is last Assert() I got error "debug assertion failed"
when I try start application.
How can I check what is wrong ?