/* 05/29/03 P. Kudela now multi class supported */ #include #include #include #include #include #include "lnet.h" int main(int argc, char* argv[]) { FILE *inp,*out,*nodefile; HIS* hist; int ne,ni,k,n,max_n,i,lrodz,*N,*Nh,ns,npr; char outname[100]; if(argc<4) { fprintf(stderr,"\nUSAGE:\n\tmkhist \n"); return 1; } k=atoi(argv[3]); if(!(inp=fopen(argv[1],"r"))) { fprintf(stderr,"Can't open input file: %s\n",argv[1]); return 2; } if(!(nodefile=fopen(argv[2],"r"))) { fprintf(stderr,"Can't open node file: %s\n",argv[2]); return 2; } fscanf(nodefile,"%i\n",&lrodz); if(k>lrodz) { fprintf(stderr,"%i > no of kind\n",k); return 2; } N=(int*)malloc(lrodz*sizeof(int)); for(i=0;imax_n?Nh[i]:max_n; if(!(hist=calloc(max_n,sizeof(HIS)))) { fprintf(stderr,"error calloc(hist)\n"); return 3; } n=0; while(1) { sprintf(outname,"HISTO.%i",n); if(!(out=fopen(outname,"w"))) { fprintf(stderr,"Can't open output file %s\n",outname); return 2;} for(i=0;i