I want to print out text (from a file previously opened) until I press the key q
. All of the methods I have tried pause my text being printed out. Is there a way to print the text while looking for a key press in C?
ex:
//after turning off canonical mode and echoing
char* output = "press q to stop this";
char ch;
while(ch = getchar()!= 'q')
{
printf("%s\n",output);
}
It only prints the prompt after you enter a char. I want it to continue to print the prompt continuously.
Solved my problem with this webpage that I found: http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/