-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathscreen.c
44 lines (37 loc) · 937 Bytes
/
screen.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
/*_ SCREEN.C 10-Aug-83 */
/* Test mono or color screen attributes */
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
int main()
{
COORD sbcoord;
COORD sbsize;
SMALL_RECT sdrect;
CHAR_INFO sbbuf[16 + 1 + 16];
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
sbcoord.X = 0;
sbcoord.Y = 0;
sbsize.X = 16+1+16;
sbsize.Y = 16;
for (int row = 0; row < 16; row++)
{
sdrect.Left = 0;
sdrect.Top = 2 + row;
sdrect.Right = sdrect.Left + 16+1+16;
sdrect.Bottom = sdrect.Top + 0;
for (int col = 0; col < 16; col++)
{
int i = row * 16 + col;
sbbuf[col].Char.AsciiChar = i;
sbbuf[col].Attributes = 0x07;
sbbuf[16 + 1 + col].Char.AsciiChar = 'A';
sbbuf[16 + 1 + col].Attributes = i;
}
sbbuf[16].Char.AsciiChar = (row > 9) ? row - 10 + 'a' : row + '0';
sbbuf[16].Attributes = 0xF0;
WriteConsoleOutput(hStdout,sbbuf,sbsize,sbcoord,&sdrect);
}
return 0;
}