February 18th, 2013, 12:27 AM
Check a part of string while user enters input - C
I am trying to write a program where I need to check when a sequence of character is pressed while taking the input from user at the run time. I am not sure how to do that. for example, my sequence of character (keyword): 1011
and my input is:abcdef1011addbbbd
as soon as user write "1011" my flag variable should go from 0 to 1.
note : user should not press enter and then check for the input string.
Thanks in advance... any help is most welcome.
February 18th, 2013, 01:59 AM
Ah well, this little trick requires you to tell us which OS and Compiler you're using.
Originally Posted by luvmonti
Standard C and C++ only deal with buffered standard input.
So anything with a finer level of control (down to individual key presses) requires a more specific (that is, it won't work everywhere) answer.