forked from swap612/Parallel-All-Pair-Shortest-Path
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadBinFile.c
38 lines (33 loc) · 1.18 KB
/
readBinFile.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
/*************************************************************************************************
* File: readBinFile.c *
* Description: Read Binary input file for testing purpose *
* *
* Authors: Group-10 (Jatin, Swapnil) *
* *
************************************************************************************************/
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char *argv[])
{
if(argc != 3 ){
printf("Invalid Arguments !! \n");
printf("Usage: %s filename NodeCount \n", argv[0]);
return -1;
}
char *infile = argv[1];
int V = atoi(argv[2]);
printf("V is %d\n", V);
FILE *fp = fopen(infile, "rb");
int value;
int rc;
int i =0;
while (rc = fread(&value, sizeof(int), 1, fp) > 0)
{
printf("%d\t", value);
i++;
if(i == V){
printf("\n");
i =0;
}
}
}