|
|
|
|
|
 Re: getch()单用会产生段错误? - passworld [ 2005-06-28 15:10 | 210 byte(s)]
 Re: getch()单用会产生段错误? - passworld [ 2005-06-28 17:06 | 35 byte(s)]
 Re: getch()单用会产生段错误? - kangjie501 [ 2005-06-28 16:51 | 11 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
我的这个程序使用了getch(),编译时连接了curses库,为何运行就产生段错误呢?难道getch()不可以单独使用么?
#include <curses.h>
#include <stdio.h>
int main()
{
int c, ch;
c=getch();
return 0;
}
gcc -o demo main.c -lcurses
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
我只是想在命令行下输入单个字符,无需回车,程序即能够处理
getchar()是需要回车的
在Linux下, 我该使用什么函数代替getch()呢?
thanks!
|
|
|
[Original]
[Print]
[Top]
|
|
|