In the program i made tried to login and it does not work i am not sure what i did wrong.
[Click Here](http://www.onlinegdb.com/B15uh6kB_)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXUSERNAME 30
#define MAXPASSWORD 20
typedef struct
{
char username[MAXUSERNAME];
char password[MAXPASSWORD];
} pass;
int main()
{
char userName[MAXUSERNAME];
char password[MAXPASSWORD];
pass t;
int c;
FILE *P= fopen("teachers.txt", "rb");
if (P == NULL)
{
printf("Error! opening file");
exit(1);
}
do
{
printf("\nUsername:");
fgets(userName,MAXUSERNAME,stdin);
printf("\nPassword:");
fgets(password,MAXPASSWORD,stdin);
if((!strcmp(userName, t.username)) && (!strcmp(password, t.password)))
{
printf("Welcome to the Ahjin Private Primary School Repot Renerating System");
}
else
{
printf("\nLogin Failed \nEnter Username & Password Again\n");
c++;
}
}
while(c<=3);
if(c>3)
{
printf("Login Failed");
printf("Sorry,Unknown User.");
}
}