I'm trying to create a login system for my operating system that checks whether the inputted username and password match the correct values ("admin" and "InHome123", respectively). I'm using a login function that takes in the user's input and returns a value indicating whether the input is correct. However, when I run my operating system and input a correct username and password, I see an "S" character printed at the end. Can anyone help me understand why this is happening?
I taken this screenshot while running my Operating System.
Here's the relevant code I'm using:
int login(char user, char pass, int userCorrect) {
if (user == "admin" && pass == "InHome123") {
userCorrect = 1;
printf(userCorrect);
return userCorrect;
}
else {
userCorrect = 0;
printf(userCorrect);
return userCorrect;
}
}
// In Main Function
char username[255];
char password[255];
int userCorrect = 0;
do {
printf("| Lixt OS |\n");
printf("Username: ");
memset(username, 0, sizeof(username));
getstr_bound(username, strlen(shell));
printf(username);
printf("Password: ");
memset(password, 0, sizeof(password));
getstr_bound(password, strlen(shell));
printf(password);
printf("\n\n\n\n\n\n");
login(username, password, userCorrect);
} while(userCorrect == 0);