Skip to content

Instantly share code, notes, and snippets.

@rhoit
Created July 22, 2013 17:24
Show Gist options
  • Save rhoit/6055769 to your computer and use it in GitHub Desktop.
Save rhoit/6055769 to your computer and use it in GitHub Desktop.
/*
Title: Configuration for OS
Started: Oct 2008
Last Update: 9 Oct 2008
Revised: 0
Program Status: Test mode
Pipeline: None till date
*/
#ifdef MSWin
#include<conio.h>
#define cls system("cls")
#else
#define cls system("clear")
#include <termios.h>
#include <unistd.h>
int getch()
{
struct termios oldt,
newt;
int ch;
tcgetattr(STDIN_FILENO, &oldt);
newt= oldt;
newt.c_lflag &= ~(ICANON| ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
ch= getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
return ch;
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment