I cant seem to get these functions to work on my system, I would be much obliged if someone could compile/run them.
Code:
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
struct termios save_attr;
void set_terminal(void)
{
struct termios set_attr;
set_attr.c_lflag &= ~(ICANON|ECHO);
tcgetattr(0, &save_attr);
tcsetattr(0, TCSANOW, &set_attr);
}
void reset_terminal(void)
{
tcsetattr(0, TCSANOW, &save_attr);
}
int main()
{
char buf[100];
printf("Enter your name...\n");
set_terminal();
fgets(buf, sizeof(buf), stdin);
reset_terminal();
printf("Your name is %s\n", buf);
return 0;
}
Its official, what worked in Slackware 8.1 (above), does not work in 9.1. I would be interested to know why...