I am working on a control break algorithm in C, and part of this algorithm is to have while loop check for the end of file and whether two strings equal each other.
the first string is a part of a typedef struct structure called 'record' rec.state, and the second one is a variable called statecontrol which I set to:e
while((fgets(line,MAXLINE-1,filein) != NULL)
{
memset(&rec,0,sizeof(record));
sscanf(line,"%s %s %s %s %d",rec.state,rec.county,rec.city,rec.salesman,&rec.sales);
strcpy(statecontrol,rec.state);
while(fgets(line,MAXLINE-1,filein) != NULL && rec.state == statecontrol)
I did various tests, and both strings print out the same information.