linux286社区 » linux编程 » Linux下使用getch函数


2007-3-5 22:09 linux286
Linux下使用getch函数

linux下使用getch函数,必须使用curses库。

测试程序
#include   <stdio.h>     
#include   <curses.h>     
   
int   main(void)     
{     
       char   ch;     
   
       printf("Input   a   character:");     
       ch   =   getch();     
       printf("\nYou   input   a   '%c'\n",   ch);     
       return   0;     
}     

编译时加上-lcurses参数。

页: [1]
查看完整版本: Linux下使用getch函数


Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.