i need to compare what the user inputs to what i have previously stored using strncpy...i know that the strncpy part works, i run into problems when i compare input to puser->Username etc...
int admin_signIn(struct profile *puser)
{
int i=0;
for(i=0;i<3;i++)
{
strncpy((puser+i)->UserName, "admin", strlen("admin")+1 );
strncpy((puser+i)->Pwd, "password", strlen("password")+1 );
printf("Enter admin user name:");
fgets(input,10,stdin);
rewind(stdin);
printf("Enter admin password:");
fgets(input,10,stdin);
//printf("the password is %s", puser->Pwd);
if(strcmp((puser+i)->UserName, input)==0 && strcmp((puser+i)->Pwd, input)==0)
{
printf("The Administrator username and password is incorrect, please try again\n");
}
else
{
printf("the info is good\n");
}
}
printf("max number of attepmpts exceded, goodbye!");
}