-1

I want to make a program that runs forever and takes a user input, something like

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*/
    }
}

I want to do this on a KISS controller, which does not have the conio.h file ready to import and therefore I cannot use the getch function. Is there another way to find out what key is being pressed at the moment?

phuclv
  • 37,963
  • 15
  • 156
  • 475

1 Answers1

0
#include<stdio.h>

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

Hope this helps.

yajiv
  • 2,901
  • 2
  • 15
  • 25
  • Doesn't answer my question. This waits for user input and then press enter. I need it so that it doesn't wait and immediately repeats the letter it gets. – Lorem Ipsum Mar 05 '18 at 12:13