OK, thank you very much. I didn't see the link the first time I read your reply lol. I changed the fgets(), and now there are no more errors. Unfortunately, nothing is being printed after I type login or register when I execute the program. DO you know how I can fix this?
Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
char log_status[256] = "";
char username[256] = "";
char password[256] = "";
char password_r[256] = "H";
printf("Hello and welcome to Visualizer Creator! If you have an account, please type login. If not, please type register.");
fgets(log_status, 256, stdin);
if (strcmp(log_status, "login") == 0) {
printf("Input Username: ");
fgets(username, 256, stdin);
printf("Input Password: ");
fgets(password, 256, stdin);
printf("Welcome to the program!");
}
else if (strcmp(log_status, "register") == 0) {
printf("Input Username: ");
fgets(username, 256, stdin);
printf("Input Password: ");
fgets(password, 256, stdin);
printf("Please input your Password again: ");
fgets(password_r, 256, stdin);
if (strcmp(password, password_r) == 0) {
printf("Thank you for registering!");
}
else {
printf("Error, password must be the same both times");
}
}
return 0;
}