#include <stdio.h>
#include <conio.h>
#include <Windows.h>
int main()
{
char buffer;
int i = 0;
while(true)
if( kbhit())//kbhit란?입력버퍼에 입력값이 있을경우 true 반환 없으면 false
{ i++;
buffer = getch(); //(1)
if( buffer == 13){
printf("역엔");
}else{
printf("%c", buffer);
}
}
printf("오오미") ;
return 0;
}
이렇게 하면 된다.
이유는 엔터를 쳤을 때 printf("%c", buffer);가 char 값으로 버퍼의 엔터키를 출력하는 모양인데,
엔터키의 char이 아마 output 표현이 라인 클리어 같은것인듯....이건 레퍼런스를 더 찾아봐야 알겠지만.
아무튼 엔터 쳤을 때 printf가 안되게 해주면 된다.
printf("%c", buffer); printf("%c", 13); 돌려봤더니 맞네. 바로바로 먹힌다
kbhit 좀 그만 써라