Data Structures Lerax 1.0.0
Essential Data Structures for C language
Loading...
Searching...
No Matches
pause.h
Go to the documentation of this file.
1/*
2 * ============================================================================
3 *
4 * Copyright 2017 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#ifndef DS_UFC_H
17#include <stdio.h>
18#endif
19
23static inline void flush_stdin() {
24 char c;
25 ungetc('\n', stdin); // ensure that stdin is dirty
26 while(((c = getchar()) != '\n') && (c != EOF));
27}
28
32static inline void pause() {
33 printf("Press enter to continue...");
34 flush_stdin();
35 getchar();
36}
37
38#endif