I am trying to set up a c capture the flag challenge but I cannot get the if statement to work.
I have a text file with the following line in it:
flag{alm0st_th3r3}
This checks against my character phrase which is the same so should print out the answer and if not print out wrong.
I have tried it a number of ways and can't see where I am going wrong.
The printf(flagText) and printf(phrase) just confirm that both are the same.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main()
{
    FILE *flag;
    flag = fopen("flag.txt", "r");
    if (flag == NULL)
    {
    puts("Error: Opening file: Maybe you are in the wrong Zm9sZGVyIG9yIGRpcmVjdG9yeSAtIHRoZXJlIGFyZSAyMCBhZnRlciBhbGwh ?");
    return 1;
    }
    char flagText[100];
    fgets(flagText, 100,flag);
    fclose(flag);
    printf(flagText);
    char phrase[100] = "flag{alm0st_th3r3}";
    printf(phrase);
    printf("\n");
    if (flagText == phrase )
    {
        printf("9mLf%BkqX6@:Cp5FC/!%D)5O@Dbkc");
        return 0;
    }
    else
    {
        printf("Sorry - wrong!!");
        return 1;
    }
}
 
    