EXT Library - pause

The lib::pause is an attempt to provide environment and operating system independent alternative to std::system ("pause");


int lib::pause ();

The return value is a code of the character that has been pressed.


Use the lib::pause to suspend a console application until user presses (any/enter) key. The function takes no parameters, displays prompt to press any key (or enter key), and suspends the program until pressed.

You will need to include "ext/lib_bits/pause.cpp" into your project in order to use lib::print.


#include <ext/lib>

int main () {
    // ...

    lib::pause ();
    return 0;


On Windows 2000 and Windows XP operating systems the function displays a string 9003 from resources of cmd.exe. If that string is not available a "Press any key to continue... " is displayed. The _getch function is used to wait for a key.

Other operating systems will display "Press enter key to continue... " and wait for the key using std::getchar.