Bug of read data

I want to read data from ttys5.But I have some bug for “read()”.this is my code:

telem_fd = ::open(ttys5,O_RDWR | O_NOCTTY | O_BINARY);
read(telem_fd,buf,sizeof(buf));

the first byte is lost.buf[0] is the second byte.
as I want to read “0xff 0x0a 0x01”,but it read “0x0a 0x01”,buf[0] is 0x0a,and 0xff is lost.

1 Like