Home > Software engineering >  Vc 6.0 problem
Vc 6.0 problem

Time:10-27

I had a c code, written in vc + + 6.0 to open the file, when I don't have to create the file, run not wrong, only that can not find the file, but when I created the file, the problems of the operation is
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,
  • Related