Use this version of strcmp()
:
if (strncmp(choice, "encrypt", 7) == 0)
The problem is that fgets
stores the newline character with your string, so to take only the first N characters to compare and leave the \n
out of the comparison , use strncmp
to give the amount of chars you want to compare with