[En-Nut-Discussion] How to write character filter with timeout?
harald.kipp at egnite.de
Thu Aug 20 09:31:04 CEST 2009
Ulrich Prinz wrote:
> _ioctl(_fileno(dev), UART_SETREADTIMEOUT, &t);
> Is there a non-blocking function for fgetc() or do I have to do stream
> parsing or is there any easier way?
When you set a read timeout on a specific device, then the related
fgetc() on that device will be non-blocking. When -1 is returned, you
can use feof() or ferror() to distinguish between timeout (end of file)
More information about the En-Nut-Discussion