//{ #include #include void read_voltages(float *V, int r, int c, int *crate, int *slot){ FILE *dbFile1 = fopen("../Testlab1_10451.set","r"); char temp[200],temp1[200],*crate1,*slot1; crate1=(char*)malloc(1000); slot1=(char*)malloc(1000); char s[200],str[200],s1[200],s0[200],cr[200],sl[200]; //Float_t V[20][20]={0},b; float b; int i=0,k=0,pos=0,l=0,n=0; char t1,s1; //int crate[20],slot[20]; while(fgets(temp, sizeof(temp), dbFile1) !=NULL) { i=0; n=0; sscanf(temp,"%s", &s); if('#'!=s[0]) // in the .set file this character mark comment { sscanf(temp,"%s %s", &cr,&sl); t1=cr[4]; sprintf(crate1,"%c",t1); if(*(sl+2)==NULL) sprintf(slot1,"%c",*(sl+1)); else sprintf(slot1,"%c%c",*(sl+1),*(sl+2)); *(crate+(k-1))=atoi(crate1); *(slot +(k-1))=atoi(slot1); //cout<<" slot = "<