how do I 'pause' execution of a routine (cout), or delay events in console C++? I assume the ctime library can be used somehow. The objective is to slow down console scrolling/displays to make them more visible, or to wait for user input in a game program. I am using MSVisual C++ 5.0 on Windows 2000 pro (for console) and Metrowerks code warrior 6.0, Win 98, console.
Tord , Thank you for your question.
I don't believe that the I/O system has the capability of sending or receiving I/O events slowly, however you may be able to achieve the same result in other ways.
One possibility is to write a "wrapper" function around printf or some of the ostream functions that would send a character then wait for a few milliseconds, using a high-resolution timer or the Sleep function or a message loop.
Another possibility is to create a Windows hook for character output that would maintain a queue of output events and send them slowly (the thread message queue can't be used to store many messages on some versions of Windows), or would run in a separate thread.
Ideally, you probably want to do panning, not slowing of character output. Panning requires direct access to the console as a pixel-level scrolling window, which I believe is not supported. Since you seem to be working under Windows, I would recommend that you give up the Console mode and use Windows directly. Console mode is only really supported for compatible execution of old MSDOS programs and batch files.