Same as the title, i have a file with this format. First i read the number and then the string. The problem is i cannot compare str with the string s "ABCD", the strcmp function should return 0, it instead returns 1. And i also want to compare str with a string input from keyboard (s1), let say "ABCD" as well. Thanks in advance
void main()
{
char s[] = "ABCD",str[100],s1[190];
int i;
FILE*fi;
fi = fopen("fi.txt","r");
fscanf(fi,"%d",&i);
fgets(str,255,fi);
scanf("%s",s1);
printf("%d\n",strcmp(s,str));
system("PAUSE");
/*this is my fi.txt file:
1
ABCD
*/
}