Hi,

I am trying to design a communication protocol between a device and a PC.

The device sends integers from 0 to 0xFF and the PC is supposed to read them.

The problem I am having is reading the zeros! All other values (from 1 to 0xFF) work fine.

The code of the PC program is (in a while loop with timeouts):
// read 1 character at a time
unsigned char c;
ReadFile(handle, &c, 1, &n_bytes_read, NULL);


When the device sends a 0 integer, the ReadFile() function returns with n_bytes_read = 0.

So there is no way finding out if ReadFile() didn't read any value OR it read a 0 integer (which is the NULL character in ASCII).

Help.

Thanks,

S.