Get the count of bytes waiting on a serial port before reading, linux

I am converting a Win32 serial class to Linux (Ubuntu) one of the required functions of this serial class is to "peek" at the serial buffer to see how many bytes are waiting on the serial port before reading the serial port.

In this pedicure situation I only need to know if there are ANY bytes on the port before attempting to read it.

In windows I used COMSTATS but I can't seem to find a similar function in Linux.

My question is:

On Linux How do you read the amount of BYTES/chars waiting on a serial port without removing them from the serial port buffer?

8
задан Will Dean 15 July 2013 в 19:20
поделиться