-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHW3a.c
More file actions
executable file
·72 lines (57 loc) · 1.29 KB
/
Copy pathHW3a.c
File metadata and controls
executable file
·72 lines (57 loc) · 1.29 KB
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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
main()
{
FILE *f1;
FILE *f2;
FILE *f3;
FILE *fpipe;
char line[512];
int count;
int i,x,j,y;
for (y =1; y <= 4; y++)
printf("\n" "I/O Bound Test Program\n\n");
f1=fopen("file1", "w");
f2=fopen("file2", "w");
f3=fopen("file3", "w");
fprintf(f1,"\nThis is a Scheduler Benchmarking Sample 1)"); /*Write Program Header*/
fprintf(f1, "\nThis code will generate Prime Numbers btw 1 and 1000000\n\n");
fprintf(f2,"\nThis is a Scheduler Benchmarking Sample 2)"); /*Write Program Header*/
fprintf(f2, "\nThis code will generate Prime Numbers btw 1 and 1000000\n\n");
fprintf(f3,"\nThis is a Scheduler Benchmarking Sample 3)"); /*Write Program Header*/
fprintf(f3, "\nThis code will generate Prime Numbers btw 1 and 1000000\n\n");
for (i = 1; i <= 20000 ; i++)
{
fprintf(f1, "i = %d\n", i);
}
for (x = 1; x <= 10000 ; x++)
{
fprintf(f2, "x = %d\n", x);
}
for (j = 1; j <= 5000 ; j++)
{
fprintf(f3, "j = %d\n", j);
}
fclose(f1);
fclose(f2);
fclose(f3);
f1=fopen("file1", "r");
f2=fopen("file2", "r");
f3=fopen("file3", "r");
while(fgets(line, sizeof(line),f1))
{
printf("%s\n", line);
while(fgets(line, sizeof(line),f2))
{
printf("%s\n", line);
}
while(fgets(line, sizeof(line),f3))
{
printf("%s\n", line);
}
}
}
return 0;
}