-
-
Save rhoit/8751919 to your computer and use it in GitHub Desktop.
nostalgic memory!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Title: Configuration for OS | |
| Started: Oct 2008 | |
| Last Update: 9 Oct 2008 | |
| */ | |
| #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