-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.c
109 lines (92 loc) · 1.67 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <stdio.h>
#include "conio.h"
// sudo service ssh start
//~/projects/Linux/bin/x64/Debug
void Test1()
{
int i;
c_clrscr();
for (i = 0; i < 20; i++)
{
printf("%d\r\n", i);
}
printf("\r\nPress any key to clear screen");
c_getch();
c_clrscr();
printf("The screen has been cleared!");
c_getch();
}
void Test2()
{
struct text_info ti;
c_gettextinfo(&ti);
printf("attribute %2d\r\n", ti.attribute);
printf("normal attribute %2d\r\n", ti.normattr);
printf("screen height %2d\r\n", ti.screenheight);
printf("screen width %2d\r\n", ti.screenwidth);
printf("current x %2d\r\n", ti.curx);
printf("current y %2d\r\n", ti.cury);
}
void Test3()
{
/*
Gets character from keyboard, does not echo to screen.
getch reads a single character directly from the keyboard,
without echoing to the screen
*/
int c;
int extended = 0;
c = c_getch();
if (!c)
extended = c_getch();
if (extended)
printf("The character is extended\n");
else
printf("The character isn't extended\n");
}
void Test4()
{
int ch;
printf("Input a character:");
ch = c_getche();
if (ch)
{
printf("\nYou input a '%c'\n", ch);
}
}
void Test5()
{
int i;
c_clrscr();
for (i = 0; i < 9; i++)
{
c_textattr(i + ((i + 1) << 4));
printf("This is a test\r\n");
}
}
void Test6()
{
c_clrscr();
c_gotoxy(35, 12);
printf("Hello world");
c_getch();
}
void Test7()
{
printf("Press any key to continue:");
while (!c_kbhit())
{
}
printf("\r\nA key was pressed...\r\n");
}
int main(void)
{
//Test1();
//Test2();
Test3();
//Test4();
//Test5();
//Test6();
//Test7();
return 0;
}