I am having trouble using fscanf and would appreciate any help. I am trying to read from a file that I am in control of. Since I knew the format this is what I tried to do reading from that file.
typedef struct {
    char *website;
    char *user;
    char *password;
    char *description;
} Account;
typedef struct Database Database;
struct Database { 
    int number_of_acc;
    Account **accounts;
};
int 
load_database(Database *db, FILE *fp) {
    char website[MAX_BUFFER_SIZE], username[MAX_BUFFER_SIZE], password[MAX_BUFFER_SIZE];
    Account acc;
    if (db->number_of_acc == 0)
        db->accounts = malloc(5*sizeof(acc));
    while(fscanf(fp, "%s: %s, %s", website, username, password ) == 3) {
        if(db->number_of_acc > 5) 
            db->accounts = malloc(2*db->number_of_acc*sizeof(acc));
        acc.website = website;
        acc.user = username;
        acc.password = password;
        //acc.description = description;
        db->accounts = malloc(sizeof(acc));
        db->number_of_acc += 1;
    }
    return Success;
}
However, when going through gdb fscanf is not returning 3 so the while loop is ignored. Here is the input file.
Reddit: Username, Password
Any advice and help in terms of my code are greatly appreciated. Thank you for your time.
 
    