Hello Everyone,
I am a complete newbie to C, and I have been trying to do some serial programming.
I opened a serial port in linux using:
int fd = open ("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK );
I understand that to read the port I need to do this:
read(fd, buffer, num_char);
However my question is, is there a way to know if there is something to read from "fd" before calling read()? I tried pread(), but it just returns -1 on the serial port (maybe it is not seekable?).
Thanks in advance,
Andy
(Please bear with me, I probably don't know what I am talking about...)