Hi!!
I've trying to implement this function:
Code:
void display(account *x,FILE *ptr){
account temp;
strcpy(temp.user_name , "doesn't exist.");
strcpy(temp.password , "Doesn't exist.");
temp.privilige = 4;
int i = 0;
while(!feof(ptr)){
fread(&temp,sizeof(account),1,ptr);
if(!strcmp(temp.user_name , x.user_name)){
temp = *x;
exit(1);
}
}
printf("\tThe name is: %s\n",temp.user_name);
printf("\tThe password is: %s\n",temp.password);
switch(temp.privilige){
case 1 :
printf("\tThe privilige is admin.\n");
break;
case 2:
printf("\tThe privilige is: general\n");
break;
case 3:
printf("\tThe privilige is mail-only.\n");
break;
default :
printf("Doesn't exist.\n");
}
exit(1);
}
}
Why the compilter says "user_name" undeclared in the first strcmp call??
I didn't finish debugging it so..it is full of problems I guess!