I have this code
Code:
/*checking if the products in supplyfile correspond in real products*/
void runF22(int N)
{
int i=0,found, productnummax,productnum=0;
char line[1000],*f;
char Msg05[]="The product code doesn't exist";
struct Sys_Rec a;
struct Prod_Rec b, B[Prod_Items_max];
FILE *p_product, *p_sys;
/* we open sys.dat to find product max number*/
/* and products File name to open it*/
p_sys=fopen("sys.dat","r");
while(!feof(p_sys)){
fscanf(p_sys,"%d %d %s %d %s %d %d %s",&a.Sys_WhNum,
&a.Sys_ProdNum,a.Sys_WhFN,&a.Sys_StorVol,a.Sys_ProdFN,
&a.Sys_SupMaxItems,&a.Sys_OrdMaxItems,a.Sys_VolDescr);
}
productnummax=a.Sys_ProdNum;
f=a.Sys_ProdFN;
fclose(p_sys);
p_product=fopen(f,"r");
/* cheking if product file is empty*/
if(p_product==NULL){
printf("error reading product file");
exit(5);
}
/*open product file and create an array B to store objects*/
/* and find the number of product exists*/
while(fgets(line,998,p_product)){
int ret;
ret=sscanf(line,"%d %s %d %s", &b.Prod_Code,b.Prod_Descr,
&b.Prod_Vol,b.Prod_Storage_Option);
B[productnum]=b; /*store in array B if line is Ok*/
productnum++;
if(productnum==productnummax) break; /*don't read too many*/
}
/*checking if all items for import exist as product*/
i=0;found=0;
while(i<productnum && found==0){
if(B[i].Prod_Code==N)found=1;
i++;
}
if(found==0){
fprintf(stderr,Msg05); /*not real product for import*/
exit(5);
}
else
return; /*if the item exist to F21 to continue*/
}
CAN SOMENONE TELL ME A LIST OF CHARACTERISTICS THAT NEED TO BE CHECKED IF WE WANT TO CONTROL (CHECK) THAT THE CODE IS RIGHT ??