Code:
FILE *fp;
char *p;
char str[35];
int counter = 0;
fp = fopen("data5.txt","r");
if(fp == NULL)
{
gotoxy(70,5);
puts("No data5.txt with codes.");
}
while(fgets(str,35,fp)!= NULL)
{
if(lineNo[counter + 1] == 1)
{
gotoxy(30,counter + 4);
puts(str);// ***
}
counter++;
}
fclose (fp);
This *** printing should take place when lineNo[counter + 1] == 1 which it does correctly but when lineNo[counter + 1] == 0 a new line is being printed and that is unintended. Please help. Zach K.