我在Windows上写了这个简单的程序.由于Windows有conio,它工作得很好.
#include <stdio.h>
#include <conio.h>
int main()
{
char input;
for(;;)
{
if(kbhit())
{
input = getch();
printf("%c", input);
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想将它移植到Linux,而curses/ncurses似乎是正确的方法.如何使用这些库代替conio来实现同样的目标?