It practically is operating system specific, since the C++11 (or C++14 or C++17) standard don’t offer any such facilities (the only standardized way of getting input being C++ streams such as std::istream
or C stdio files à la FILE*
). You probably need some external libraries.
On Linux or POSIX systems, consider (for a terminal interface) some library like ncurses. Perhaps a multiplexing system call, à la poll(2), should be useful (for the timeout).
Perhaps you want a GUI interface. Then look into Qt (or some other widget toolkit).
solved How can I cancel an inputting when a previously defined time is over