Code:
if(publisher>=pub1loop && publisher<=pub2loop){
ret = 1;/*return 1 if the publisher sents falls between*/
}
i think this is where my problem is, because ret is never setting to 1
example i send in "70002" <- publisher char
and pub1loop equals "70000" and pub2loop equals "79999"
this is my full function:
Code:
int registered(FILE* fp, int area, const char* publisher){
int pub1loopint, pub2loopint, ret=0;
char pub1loop[7], pub2loop[7], arealoop[7], areatostring[7];
sprintf(areatostring, "%i", area);
rewind(fp);
while(!feof(fp)) {
fscanf(fp, "%s %c %c", arealoop, pub1loop, pub2loop);
if(strcmp(areatostring,arealoop)==0){/*do this when the two areas are the same*/
pub1loopint = atoi(pub1loop);
pub2loopint = atoi(pub2loop);
if(publisher>=pub1loop && publisher<=pub2loop){
ret = 1;/*return 1 if the publisher sents falls between*/
}
}
}
return ret;
}