Data Structures Lerax  v3.0-104-ge031
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
pause.h
Go to the documentation of this file.
1/*
2 * ============================================================================
3 *
4 * Copyright 2017-2025 Manoel Vilela
5 *
6 * Author: Manoel Vilela
7 * Contact: manoel_vilela@engineer.com
8 * Organization: UFC
9 *
10 * ============================================================================
11**/
12
13#ifndef PAUSE_H
14#define PAUSE_H
15
16#include <stdio.h>
17
24static inline void flush_stdin() {
25 char c;
26 ungetc('\n', stdin); // ensure that stdin is dirty
27 while(((c = getchar()) != '\n') && (c != EOF));
28}
29
36static inline void pause() {
37 printf("Press enter to continue...");
38 flush_stdin();
39 getchar();
40}
41
42#endif