I have this C code which compiles under Linux and allows me to manipulate the buffering so I can read one key at a time from the keyboard (w/ no automatic echo). It allows me to get inkey() type functionality. Is there any way I can convert it to PBLinux?
Thanks,
Phil
#include <termio.h>
struct termio savetty; struct termio newtty;
#define gtty(fd,arg) (ioctl(fd, TCGETA, arg))
#define stty(fd,arg) (ioctl(fd, TCSETAF, arg))
cbmode()
{
if (gtty(0, &savetty) == -1) {
printf("ioctl failed: it's not a terminal\n");
exit(-1);
}
newtty = savetty;
newtty.c_lflag &= ~ICANON; newtty.c_lflag &= ~ECHO;
newtty.c_cc[VMIN] = 1;
newtty.c_cc[VTIME] = 1;
if (stty(0, &newtty) == -1) {
printf("terminal won't go into cbreak mode\n");
exit();
}
}
reset() { stty(0, &savetty); }
Linux ioctl?
have a look at "man curses" there you will get all the C calls which can
then we called also by PB after opening the Curses Lib.
The Curses lib is the best way of controlling IO on linux but it's very lowlevel
which by meens results in RE_writing console IO for the use in PB, which I
personaly dont like because its a lot of work (still small though)..
I hope fred will release the basic Ncurses calls in a PB lib in his next
release of PB..
Regards, Pbdep
then we called also by PB after opening the Curses Lib.
The Curses lib is the best way of controlling IO on linux but it's very lowlevel
which by meens results in RE_writing console IO for the use in PB, which I
personaly dont like because its a lot of work (still small though)..
I hope fred will release the basic Ncurses calls in a PB lib in his next
release of PB..
Regards, Pbdep