-6
while (exit!=true )
{
   input sprintf(thename, "person%d.txt", thecounter);
   searchfile=fopen(thename,"r");
   fscanf(searchfile,"%d%s%s%f%f\n",&theperson.id,theperson.firstname,theperson.lastname ,&theperson.sallary , &theperson.saving);    
   numfirst =strcmp(inputfirstname,theperson.firstname);
   numlast  = strcmp(inputlastname ,theperson.lastname);
   if ( numfirst == 0 || numlast == 0 ) 
}

I've been trying to make this so far its only work if I don't use loop and diretly point at the location file.

I wanted to search and its keep on having infinite loop despite the condition and btw this is not the full code as I cannot paste the whole module ofc there incrementation and fclose condition

  • First of all the code is not complete.. – LPs Jan 19 '15 at 07:12
  • That code isn't for a spellchecker. – M Oehm Jan 19 '15 at 07:18
  • its is not complete because i don't how to put the whole code here.the problem is why this code is infinite loop. it kinda like spellchecker not 100% spellchecker thought the basic idea is use strcmp to compare beetween input and the file – albert cahyawan Jan 19 '15 at 07:25

1 Answers1

0

Its an infinite loop because (well at least from the code you provided) exit is always false and never set to true

Zaid Amir
  • 4,727
  • 6
  • 52
  • 101