CJ
2007-09-28 15:42:13 UTC
I use the following to determine how many bytes are waiting in the
terminal input.
int ret = 0;
int bytes = 0;
errno = 0;
ret = ioctl(STDIN_FILENO,I_NREAD,&bytes);
fprintf(stderr,"errno = %d, ret = %d, bytes = %d\n",errno,ret,bytes);
It works find everywhere except on the /dev/tty01, or other physical
console "windows" on SCO. Even worse, the ioctl() call above puts the
video into 40 column mode.
Why is the above ioctl() call changing the video mode, and how can I
find out how many bytes are in STDIN_FILENO (fd 0) after using
select() or poll() to detect the handle is read ready?
cj
terminal input.
int ret = 0;
int bytes = 0;
errno = 0;
ret = ioctl(STDIN_FILENO,I_NREAD,&bytes);
fprintf(stderr,"errno = %d, ret = %d, bytes = %d\n",errno,ret,bytes);
It works find everywhere except on the /dev/tty01, or other physical
console "windows" on SCO. Even worse, the ioctl() call above puts the
video into 40 column mode.
Why is the above ioctl() call changing the video mode, and how can I
find out how many bytes are in STDIN_FILENO (fd 0) after using
select() or poll() to detect the handle is read ready?
cj