Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 29 additions & 21 deletions src/_pause.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
/* ****************************************************************
* @author: James Michael Adoremos
* @app name: pause.h
* @app desc: This library shall contain a function that imitates Windows' PAUSE command
* @history:
* - 2018/02/08
* -- Created _pause() function
* ****************************************************************/

#ifndef _PAUSE
#define _PAUSE

#include <iostream>

// A function to imitate Windows' PAUSE command
void _pause() {
std::cout << "Press any key to continue...";
std::cin.get();
}

#endif
/* ****************************************************************
* @author: James Michael Adoremos
* @app name: pause.h
* @app desc: This library shall contain a function that imitates Windows' PAUSE command
* @history:
* - 2018/02/08
* -- Created _pause() function
* ****************************************************************/

#ifndef _PAUSE
#define _PAUSE

#include <iostream>

// A function to imitate Windows' PAUSE command
void _pause() {
std::cout << "Press any key to continue...";

/* Clear the input stream if the number of bytes is not 0
* This is a workaround for programs that ask for user input.
*/
if(sizeof(std::cin) != 0) {
std::cin.ignore();
}

std::cin.get();
}

#endif