Help understanding a piece of TurtlebotTeleop code
Hi all! I'm trying to modify a teleop program called turtlebot_key.cpp that came with the turtlebot_apps stack. There's this piece of code that I don't understand at all, and I've tried looking it up, and still can't make sense of it. I'm pretty sure this is where my problem is with my code right now, because i need a certain case where the terminal's handling of input is different from how the program normally works. If someone could explain this to me simply and clearly, that would be fantastic. The code is this:
int kfd;
struct termios cooked, raw;
and later:
// get the console in raw mode
tcgetattr(kfd, &cooked);
memcpy(&raw, &cooked, sizeof(struct termios));
raw.c_lflag &=~ (ICANON | ECHO);
// Setting a new line, then end of file
raw.c_cc[VEOL] = 1;
raw.c_cc[VEOF] = 2;
tcsetattr(kfd, TCSANOW, &raw);