Your Arduino code sends a byte at time (see
Arduino - Write[
^]), so your PC code should read a single byte and output it (it could optionally read multiple bytes, buffer and then output all of them), so the proper call to
ReadFile
(I hardly believe you need the
OVERLAPPED
struct in such a simple scenario) is:
unsigned char c;
DWORD dwRead;
if ( ReadFile( hComm, &c, sizeof(c), &dwRead, NULL) )
{
if ( dwRead == 1)
printf("%d\n", (int) c);
}
else
{}