打印用户键入的每个字符,不使用conio.h

打印用户键入的每个字符,不使用conio.h,c,C,我想制作一个永远运行的程序,并接受用户输入,比如 while(1) { if(currentkeybeingpressed != NULL) { print(the current character); /* So that the program just waits until a key is pressed and outputs the same letter the moment it is to

我想制作一个永远运行的程序,并接受用户输入,比如

while(1)
{  
    if(currentkeybeingpressed != NULL)
    {
        print(the current character); /* So that the program just waits until a key is 
                        pressed and outputs the same letter the moment it is touched*/
    }
}
我想在KISS控制器上执行此操作,该控制器没有准备好导入的conio.h文件,因此无法使用getch函数。是否有其他方法可以确定当前正在按下的键?

#包括
#include<stdio.h>

int main() {
   while(1){
       putchar(getchar());
   }
}
int main(){ 而(1){ putchar(getchar()); } }

希望这有帮助。

您可以使用ScanW什么是“KISS”控制器?它有什么功能?@yajiv是否可以使用scanf,这样它就不会等待用户输入?是的,有可能,请在loop@yajiv我该怎么做?没有回答我的问题。这将等待用户输入,然后按enter键。我需要它,这样它就不会等待并立即重复收到的字母。