I'm trying to take input from the user and compare it with a CSV file that contains only the same input that I'm trying to compare which is "gaber123".
For some reason, the output is "fail".
Here is the code
#include <string.h>
#include <stdio.h>
int main() {
char x[20],data[20];
scanf("%s",&x);
FILE *fp= fopen("Accounts.csv","r");
fgets(data,20,fp);
int compare= strcmp(data, x);
if(compare==0){
printf("success!");
}
else{
printf("fail");
}
return 0;
}