Mail Archives: djgpp/1998/05/12/13:16:41
Dan, Ho-Jin wrote:
>
> #include <termio.h>
> #include <sys/ioctl.h>
>
> int getch() {
> struct termio o, n;
> char c;
>
> ioctl(0, TCGETA, &o);
> ioctl(0, TCGETA, &n);
....
A minor point, but one that helps portability - most systems that
support
the termio stuff indicate that the function-call interface is preferable
to the ioctl interface. Use tcgetattr, tcsetattr in preference to ioctl.
This has the obvious advantage that it is much easier to re-implement
a function like tcsetattr on another system that doesn't have termio
done
in the device driver than it is to hack ioctl to support extra
attributes.
------------------------------------------------------------------------------
Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk
Special Projects Manager
http://www.ulcc.ac.uk/staff/Kevin+Ashley
ULCC ...ukc!ncdlab!K.Ashley (but probably not any
more)
This is not a signature
- Raw text -