I’m currently writing something of a quiz program. This program throws questions at the user until a specified time limit runs out. How it’s set up now is the quizzing functionality runs in a boost thread and the timing aspect is handled by a timed_join() on that thread. The problem I’m encountering is when the user is answering a question using cin, the thread will go past the time limit that has been established. Is there a way to have it interrupt the cin call?
I’m currently writing something of a quiz program. This program throws questions at the
Share
You can use Boost.Asio to read from
cinasynchronously as described here – updated link to example code is here.