아래 함수들을 보시고 참조하세요.
--------------------------------
#include <stdio.h>
#include <termio.h>
struct termio tbufsave;
/*
입력을 받기위해서 터미날 모드를 noecho, putctual input
으로 바꾼다.
*/
make_raw_mode()
{
struct termio tbuf;
if( ioctl(0,TCGETA,&tbuf) == -1 ) {
fprintf(stderr,"ioctl get error\n");
exit(-1);
}
tbufsave = tbuf; /* save original terminal setting */
tbuf.c_lflag &= ~ ECHO; /* no echo */
tbuf.c_lflag &= ~ ICANON; /* 요거이 no return 모드로 세팅하는 것 */
tbuf.c_cc[4] = 1; /* MIN */
tbuf.c_cc[5] = 2; /* TIME */
if( ioctl(0,TCSETAF,&tbuf) == -1 ) {
/* stdin 의 특성을 바꾼다. */
fprintf(stderr,"ioctl set error\n");
exit(-1);
}
}
/*
터미날을 이전 상태로 돌아가게 해준다.
*/
no_raw_mode()
{
if( ioctl(0,TCSETAF,&tbufsave) == -1 ) {
fprintf(stderr,"no raw mode error\n");
exit(-1);
}
}
또 다른 방법은 curses함수를 이용하는 것입니다.
이만 총총. 버섯.
----------------------------------------------------------
당신이 해낼 수 있다고 생각하든, 해낼� 수 없다고 생각하든,
당신은 항상 옳다. - 헨리 포드 -
----------------------------------------------------------