-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdjustScript.c
More file actions
32 lines (23 loc) · 726 Bytes
/
AdjustScript.c
File metadata and controls
32 lines (23 loc) · 726 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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main() {
int count[4];
count[0] = 0;
count[1] = 0;
count[2] = 0;
count[3] = 0;
char* line = NULL;
size_t len = 0;
FILE* file = fopen("./Result_Video5.txt", "r");
while (getline(&line, &len, file) != -1)
{
if (strcmp(line, "0\n") == 0) { count[0]++; }
if (strcmp(line, "1\n") == 0) { count[1]++; }
if (strcmp(line, "2\n") == 0) { count[2]++; }
if (strcmp(line, "3\n") == 0) { count[3]++; }
}
printf("%d %d %d %d", count[0], count[1], count[2], count[3]);
FILE* file2 = fopen("./R5.txt", "w+");
fprintf(file2, "%d %d %d %d", count[0], count[1], count[2], count[3]);
}