Fgets() timeout?

KenHorse

Member
I have a USB to serial converter (/etc/ttyUSB0) that I read from, using fgets.

I'm looking for a way, that if nothing is received with a few seconds, the script terminates. As in a "serial timeout".

Of course, fgets seems to hang forever if it never sees a EOL and I need a way around that
 
Back
Top