I have called the method ioctl
to check the number of bytes available with the following code :
::ioctl(serial_port, FIONREAD, &available);
I'm compiling this from Cygwin under windows 10. But I get this error:
error: ‘FIONREAD’ was not declared in this scope; did you mean ‘FREAD’?
How can I fix this? I want to check if there're bytes in the input buffer so when I poll, I don't get errors when it's empty. I have been having input/output error with error no.5
.
if it's not possible to find the FIONREAD constant, is there another way to avoid the input/output error
? I am using blocking mode too with VMIN = 0 and VTIME = 1
. So it's waiting about 100ms
with every read.
Those are my include files :
#include <string.h>
#include<iostream>
#include<stdio.h>
#include <string>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…