关于Linux之curses.h文件

来源:互联网 发布:2017大数据的发展现状 编辑:程序博客网 时间:2024/04/27 00:12

—> conio.h文件,一般用来实现getch()功能 —> 即读取键盘字符但是不显示出来
—> 在Windows环境中能编译通过。但在Linux环境下编程,conio.h文件无法编译通过,因为Linux没有这个头文件,而用另一个头问价代替:

#include <curses.h>

这个头文件依赖libncurses5-dev,终端下载:

sudo apt-get install libncurses5-dev

贴上这个头文件的内容:

/*---------in linux---------*/#include<stdio.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;}
/*---------in windows---------*/#include <stdio.h>#include <conio.h>int main(){    char c;    printf("Input a char:");    c=getch();    printf("You have inputed:%c \n",c);    return 0;}
原创粉丝点击