Over the years I've had to do this on various Unix systems. The following C code will work under SuSE Linux and most POSIX compliant systems. --------------------------------------------------------------------- #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <termios.h> void GetOne() { int rv; int fd = fileno(stdin); char ch; struct termios oldflags, newflags; /*********** Reset the terminal to accept unbuffered input ***/ /* get the current oldflags */ tcgetattr(fd, &oldflags); newflags = oldflags; /* set raw input, 1 second timeout */ newflags.c_cflag |= (CLOCAL | CREAD); newflags.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /* set the terminal to the newflags settings */ tcsetattr(fd, TCSANOW, &newflags); rv = read(fd, &ch, 1); /* restore the oldflags -- This is important otherwise * your terminal will no longer echo characters */ tcsetattr(fd, TCSANOW, &oldflags); } int main() { printf("Wait for a char: "); fflush(stdout); GetOne(); /* do this after resetting the terminal because * stdin and stdout should be the same pseudo terminal */ printf("\n"); /* simply return back to beginning of line */ return 0; } ---------------------------------- -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9