-
Notifications
You must be signed in to change notification settings - Fork 0
/
p04_user_io.c
69 lines (60 loc) · 1.49 KB
/
p04_user_io.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
//from stackoverflow:
#ifndef CLEAR_SCREEN
#ifdef WIN32
#define CLEAR_SCREEN "cls"
#else
#define CLEAR_SCREEN "clear"
#endif
#endif
// Prototypes
void flush();
void print_line();
void print_clear_screen();
void print_menu();
void print_exit();
void print_invalid_input();
// For testing purposes only:
// int main(int argc, const char *argv[])
// {
// print_menu();
// print_exit();
// print_invalid_input();
// print_clear_screen();
// return 0;
// }
// This function flushes stdin (especially for use following scanf())
void flush()
{
char extraChar;
while ( (extraChar = getchar()) != '\n' && extraChar != EOF );
}
void print_line()
{
printf("\n");
}
void print_clear_screen()
{
system(CLEAR_SCREEN);
}
void print_menu()
{
printf("Please select an option...\n" );
printf(" 1 Select input file name\n" );
printf(" 2 Select output file name\n" );
printf(" 3 Select affine cipher key\n" );
printf(" 4 Encrypt input file\n" );
printf(" 5 Decrypt input file\n" );
printf(" 6 Get directory listing\n" );
printf(" 7 Exit\n" );
printf(":" );
}
void print_exit()
{
printf("Have such a good day!!!!!!!\n\n" );
}
void print_invalid_input()
{
printf("Your input was not recognized as a valid " );
printf("option.\n\n" );
}