S
Scott Dabot
Im trying to read from a file but I want to take out the break
statements and not have an infinite loop that only stops on breaks.
for(;
{
testvariable=fscanf(infile, "%d\n", &totallibrarys);
if(testvariable==EOF)
break;
if (fgets(listoflibs[a], 50, infile)==0)
break;
n=strlen(listoflibs[a])-1;
listoflibs[a][n]='\0';
testvariable=fscanf(infile, "%d\n",&numOfBooks);
if (testvariable==EOF)
break;
for (j=0; j<numOfBooks; j++)
{
testvariable=fscanf(infile, "%s%d %d\n", &book,&numAvail, &numIn);
if (testvariable==EOF)
break;
T[a]=Insert(numAvail, numIn, book, T[a]);
}
a++;
}
statements and not have an infinite loop that only stops on breaks.
for(;
{
testvariable=fscanf(infile, "%d\n", &totallibrarys);
if(testvariable==EOF)
break;
if (fgets(listoflibs[a], 50, infile)==0)
break;
n=strlen(listoflibs[a])-1;
listoflibs[a][n]='\0';
testvariable=fscanf(infile, "%d\n",&numOfBooks);
if (testvariable==EOF)
break;
for (j=0; j<numOfBooks; j++)
{
testvariable=fscanf(infile, "%s%d %d\n", &book,&numAvail, &numIn);
if (testvariable==EOF)
break;
T[a]=Insert(numAvail, numIn, book, T[a]);
}
a++;
}