Skip to content

Instantly share code, notes, and snippets.

@ninovsnino
ninovsnino / getch_in_linux.c
Created June 14, 2016 23:12
Create yourself getch in linux using <termios.h> and <stdio.h>
#include <termios.h>
#include <stdio.h>
static struct termios old, new;
/* Initialize new terminal i/o settings */
void initTermios(int echo)
{
tcgetattr(0, &old); /* grab old terminal i/o settings */
new = old; /* make new settings same as old settings */