In Windows, C has a library conio.h, implemented a lot of functions, but Linux C does not have this library, the internal functions need to implement their own.
CLRSRC a realization of the function of clear screen:
void Clrscr (void) {System ("clear");//requires header file Stdlib.h}
Call System ("clear")
An implementation method of Getch () function
#include <stdio.h> #incldue <stdlib.h>int main () { char C; printf ("Input a char:"); System ("Stty-echo"); C=getchar (); System ("Stty echo"); printf ("You have inputed:%c \ n", c); return 0;}
This calls the system ("Stty-echo") and System ("Stty echo") implementation of the input in which is not realistic
There are some other functions not implemented under this header file, Welcome to add! If there is any mistake, please correct me.
On the implementation of CLRSRC function under Linux