#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
int main(int argc, char **argv)
{
char c;
struct termios buf, savebuf;
tcgetattr(STDIN_FILENO, &savebuf);
tcgetattr(STDIN_FILENO, &buf);
buf.c_lflag &= ~(ICANON | ECHO);
buf.c_cc[VMIN] = 1;
buf.c_cc[VTIME] = 0;
tcsetattr(STDIN_FILENO, TCSANOW, &buf);
printf("Enter one character: ");
fflush(stdout);
if ((read(STDIN_FILENO, &c, 1)) != 1)
perror("Input error");
else
printf("\nYou entered: %c.\n", c);
tcsetattr (0, TCSAFLUSH, &savebuf);
exit(0);
}
[an error occurred while processing this directive]