问C语言高手一个关于I/O的有关问题

问C语言高手一个关于I/O的问题
linux操作系统下,要怎样才能进行非缓冲也不回显的输入,就像游戏中常见的那样(按下一个键,程序立即处理它)。
setbuf(stdin,NULL) 试过,没用。setvbuf也试过,没用。:-(

------解决方案--------------------
http://linux.die.net/man/3/curs_inopts
http://linux.die.net/man/3/getch
curses 库,noecho 然后 getch
------解决方案--------------------
#include<stdio.h>
#include<termios.h>
#include<unistd.h>
#include<assert.h>
#include<string.h>


int getch()
{
 int c=0;
 struct termios org_opts, new_opts;
int res=0;
//----- store old settings -----------
res=tcgetattr(STDIN_FILENO, &org_opts);
assert(res==0);
//---- set new terminal parms --------
memcpy(&new_opts, &org_opts, sizeof(new_opts));
new_opts.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOKE | ICRNL);
tcsetattr(STDIN_FILENO, TCSANOW, &new_opts);
c=getchar();
//------ restore old settings ---------
res=tcsetattr(STDIN_FILENO, TCSANOW, &org_opts);
assert(res==0);
return c;
}


int main()
{
 int i;
 char pd[128],pd1[128];
 char a;
 printf("请输入密码:");
 while(1)
 {
for(i=0;;i++)
{
pd[i]=getch();
if(pd[i]=='\n')
{
pd[i]='\0';
break;
}
if(pd[i]==127)
{
printf("\b \b");
i=i-2;
}
else
printf("*");
if(i<0)
pd[0]='\0';
}
 
printf("\n请再次输入:");
 
for(i=0;;i++)
{
pd1[i]=getch();
if(pd1[i]=='\n')
{
pd1[i]='\0';
break;
}
if(pd1[i]==127)
{
printf("\b \b");
i=i-2;
}
else
printf("*");
if(i<0)
pd1[0]='\0';
}
if(strcmp(pd,pd1)==0)
break;
else
{
printf("\n您两次输入的密码不一致,请重新输入:\n");
printf("请输入密码:");
}
 }
 
 printf("\n您输入的密码是:[%s]\n",pd);
}