-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.c
More file actions
59 lines (53 loc) · 966 Bytes
/
text.c
File metadata and controls
59 lines (53 loc) · 966 Bytes
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
#include <stdio.h>
#include <ncurses.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "text.h"
int count = 0;
volatile int thread_exit = 1;
void readCheckers()
{
count++;
readCheckers2(count%4);
}
void * readCheckersCont(void *ptr)
{
while(thread_exit)
{
readCheckers();
sleep(3);
}
}
void readCheckers2(int A)
{
FILE * stream;
switch(A)
{
case 0:
stream = fopen("./dat/txt1.txt", "r");
break;
case 1:
stream = fopen("./dat/txt2.txt", "r");
break;
case 2:
stream = fopen("./dat/txt3.txt", "r");
break;;
case 3:
stream = fopen("./dat/txt4.txt", "r");
break;
}
char textbuffer[113*11]; // Buffer to store data
fread(&textbuffer, sizeof(char), 113*11, stream);
fclose(stream);
// Printing data to check validity
int x;
x = getmaxx(stdscr);
for (int j=0; j < 11; j++)
{
for (int i = 0; i < 112; i++)
{
mvprintw(j,x/2-112/2+i,"%c", textbuffer[i+j*112+j]);
}
}
}