I am working on a program that does something like this,
Void main()
{
cout<<"H";timedelay(1);
cout<<"E";timedelay(1);
cout<<"L";timedelay(1);
cout<<"L";timedelay(1);
cout<<"O";timedelay(1); //timedelay(int a) is a function which gives a delay
// of 'a' seconds.
{
....
}
}
This code is just for fancy and I would like to squish in some statements which would give the user an option to skip it (by entering any keyboard key),and resume with the rest of the program.
Please suggest from your knowledge and experience,on techniques to get this done!
Well this exposes the limits of my own C++ knowledge, but isn't there a standard way to check if there's any keystrokes in the keyboard buffer? If so, you could check within your timedelay() function and if a keystroke is found, return a value which main() could use to skip the remaining output.
I know that the keyboard buffer isn't the input buffer, and it just occurred to me that my head is once more impacted in my anus for thinking that the input buffer would magically get filled from the keyboard buffer behind the scenes :) Thanks for the lube.