Hey im totally new to the boards and c programming and ive been trying to make a program in which the user inputs a username and password
now when they try to login again im having trouble getting the program to read the username(external filename) and the password which is contained inside it.
here is my code...its all messed up cuz i was trying different things. If someone could please tell me how to get it so that it reads the external file("username") and opens it and compares the password inputted by the user and the password contained inside the external file("username") that would be great. Thanks
Code:
void existing()
{
int openFiles('r');
int readDataFromFile();
//Opens the file from the directory and reads the password
openFiles('r');
{
username = fopen("%s", username, "r");
}
readDataFromFile();
{
fgets("%s", username);
}
extern char username;
char *fp;
//If statement that confirms the correct username and password
if (strcmp(user, username) == 0 && strcmp(pass, password) ==0)
printf("\nAccess Granted\nYou may enter the Matrix\n");
else
printf("\n%s is incorrect\nProgram will now terminate.\n\n",password);
}