My code is (the) open the file
BL * Creat ()
{
BL * p * q;
Int j=1;
Char ch [5]={" end "};
The FILE * fp.
Fp=fopen (" busline. TXT ", "r +");
If (fp==NULL)
{printf (" can't open this file!" );
exit(0);
}
P=(BL *) malloc (sizeof (BL));
The head=p;
Q=p;
The fscanf (fp, "% d", & amp; (p - & gt; Busnum));
Do
{fscanf (fp, "% d % s", & amp; (p - & gt; Stop [j]. Journal of num), p - & gt; Stop [j] name);
j++;
} while (STRCMP (p - & gt; Stop [j - 1]. The name, ch)==1);
while(! The feof (fp))
{j=1;
P=(BL *) malloc (sizeof (BL));
Q - & gt; Next=p;
Q=p;
The fscanf (fp, "% d", & amp; (p - & gt; Busnum));
Do
{fscanf (fp, "% d % s", & amp; (p - & gt; Stop [j]. Journal of num), p - & gt; Stop [j] name);
j++;
} while (STRCMP (p - & gt; Stop [j - 1]. The name, ch)!=0);
}
Q - & gt; Next=NULL;
The fclose (fp);
return head;
}
And then in the following two questions,
sometimes is it
CodePudding user response:
To set breakpoints, step through, the do while the possibility of a cross back is?CodePudding user response:
Or debugged, know the problem immediately,