VS32, 1;
VS32, 2;
VS32, 3;
VS32, 4;
VS32, 5;
VS32, 6;
VS32, 7;
VS32, 8;
WU0;
PW0.350, 1;
PW0.350, 2;
PW0.350, 3;
PW0.350, 4;
PW0.350, 5;
PW0.350, 6;
PW0.350, 7;
PW0.350, 8;
LT;
SP1.
PU0-1200;
PD1600-1200;
PD1600 1200;
PD0 1200;
PD0-1200;
SP0;
CodePudding user response:
With a semicolon (;) Divided into good children string, and then find the PU, PD at the beginning of the string, intercept after find out the back of the coordinatesCodePudding user response:
The fscanf % * [^ 0-9] % g okCodePudding user response:
Doesn't work, it still comes out of the whole thing,#include
#include
#include
#include
Int main ()
{
FILE *fp;
Char STR [1024] [1024].
char ch;
The FILE * FPT;
FPT=fopen (" C.t xt ", "w");
If ((fp=fopen (" char. PLT ", "r"))==NULL)
{
Perror (" to read ");
The exit (1);
}
while(! The feof (fp))
{
Fscanf (fp, "% * [^ (9) - 9] % d", STR);
While ((ch=fgetc (fp))!=(EOF)
{
Fputc (ch, FPT);
}
Printf (" % s \ n ", STR, FPT);
}
The fclose (fp);
The fclose (FPT);
return 0;
}
CodePudding user response:
Try a regular expression.CodePudding user response:
Read after advice, '; 'as the separator, segmentation, respectively, and then use STRNCMP comparison, choose the PD or PU, then the use' '(space) segmentation, finally atoi converted to integers, namely the coordinates,CodePudding user response:
Regular expressions canCodePudding user response:
Read after advice, '; 'as the separator, segmentation, respectively, and then use STRNCMP comparison, choose the PD or PU, then the use' '(space) segmentation, finally atoi converted to integers, namely coordinates, come to think of the idea, thought of with a semicolon, but the length of each line is not the same, always can only appear the effect of the first line, the following is useless, but did not use STRNCMP comparison, and atoi don't know if it is no use good or no effect, it is empty, and thanks for your remindCodePudding user response: