FILE *file;
        char line[4096];
        char string[32];
        strncpy(string, user->profile_pic, 32);
        file = fopen(string, "r");
        while (fgets(line, 4096, file) != NULL) {
                printf("%s", line);
        }
        fclose(file);
STORE the name of the file. Then you read the file and immediately print it back out. You can do this in pieces and never store the entire thing. If you think about it for a while, you will realize that you don't need to assume a maximum line length for using fgets.