comparison gecko/src/hitsStat.c @ 1:35af401890c0 draft

Uploaded
author bitlab
date Thu, 13 Dec 2018 07:59:25 -0500
parents
children
comparison
equal deleted inserted replaced
0:ee6b15b409e5 1:35af401890c0
1 /* lee Hits file (diag/posX/posY)
2
3 Syntax: leeHits InputHITSFile
4 --------------------------------------------------------*/
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <inttypes.h>
9 #include "structs.h"
10 #include "commonFunctions.h"
11
12 int main(int ac, char**av)
13 {
14 FILE *f1;
15 hit H;
16 unsigned long nHits;
17 //---------------------------------
18
19 if (ac!=2)
20 terror("Use: LeeHits InputFile]");
21
22 if ((f1=fopen(av[1],"rb"))==NULL)
23 terror("Input file open error");
24
25 fseek(f1,0, SEEK_END);
26 nHits = ftell(f1)/sizeof(hit);
27 fprintf(stdout,"File size=%ld nHits=%ld\n", nHits * sizeof(hit), nHits);
28 fprintf(stdout,"---------------[RET]\n");fgetc(stdin);
29 fseek(f1,0, SEEK_SET);
30
31 if(fread(&H,sizeof(hit),1,f1)!=1){
32 terror("Empty hits file");
33 }
34 while(!feof(f1)){
35 fprintf(stdout,"d=%-7" PRId64 " pX=%-7" PRIu64 " pY=%-7" PRIu64 " seqX=%-7" PRIu64 " seqY=%-7" PRIu64 "\n",H.diag,H.posX,H.posY,H.seqX,H.seqY);
36 if(fread(&H,sizeof(hit),1,f1)!=1){
37 if(ferror(f1))terror("Empty hits file");
38 }
39 }
40
41 fclose(f1);
42 return 0;
43
44 }
45
46
47