#include
int main()
{
FILE *fp = NULL;
char str[100]={0};
char input[100]={0};
fp = fopen("password.txt","r");
if (fp==NULL)
{
printf("open file failed\n\r");
return -1;
}
fgets(str,sizeof(str),fp);
fclose(fp);
printf("please input password:\n");
gets(input);
if (strcmp(input,str)==0 )
{
printf("welcome login\n");
}else
{
printf("password is wrong\n");
}
return 0;
}