linux c下如何实现不需要回车读入一字符

来源:互联网 发布:linux中sem wait函数 编辑:程序博客网 时间:2024/05/16 03:24

/*getch()可以做到,但getch()需要用到ncurse库*/


#include <stdio.h>#include <stdlib.h>int main(void){        int c;        system("stty raw");        c = getchar();        system("stty -raw");        printf( "\nyou input: %c", c);        printf( "\n" );        return 0;}


0 0
原创粉丝点击