Is it possible to set timeout for std::cin?
Is it possible to set timeout for std::cin? For example, std::cin doesn't receive any data during 10 seconds - it throws an exception or returns an error. Edited: And what about timer from Boost library ? As far as I know, it is portable library. Is it possible to ask timer of Boost library to throw exceptions after predefined period of time? I guess it can solve this problem. It isn't possible to set a time out for std::cin in a portable way. Even when resorting to non-portable techniques, it isn't entirely trivial to do so: you will need to replace std::cin 's stream buffer. On a UNIX system