| |

VerySource

 Forgot password?
 Register
Search
View: 1223|Reply: 11

Please help me reading files

[Copy link]

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-12-11 11:30:01
| Show all posts |Read mode
,00599#大*East to West&Qunyigang$2016-12-28 08:51:52!,
61178#大*South to North&Huibin Xigang$2015-12-30 08:23:54!,
09986#大*South to North&Huibin Xigang$2016-01-05 09:30:41!,
63636#Big*South to North&Huibin Xigang$2016-01-05 17:26:10!,
13581#Big*South to North&Huibin Xigang$2016-01-06 16:22:35!,
06188#Big*South to North&Huibin Xigang$2016-01-10 08:54:29!,
61646#大*South to North&Huibin Xigang$2016-01-17 13:24:13!,
50155#Big*South to North&Huibin Xigang$2016-01-18 14:37:21!,
09478#Big*South to North&Huibin Xigang$2016-01-01 08:07:14!,
95240#Big*South to North&Finance Bureau Post $2016-01-28 07:06:03!,
91272#Big*South to North&Finance Bureau Post $2016-01-30 06:55:25!,
95268#Big*South to North&Finance Bureau Post $2016-01-31 10:43:45!,
29357#Big*East to West&Qunyigang$2016-01-14 07:26:01!,
29361#大*East to West&Qunyigang$2016-02-01 08:47:38!,
13610#大*South to North&Huibin Xigang$2016-01-19 15:19:02!,
33533#Big*South to North&Finance Bureau Post $2016-01-07 09:04:33!,
50746#Big*South to North&Finance Bureau Post $2016-01-15 13:45:40!,
15627#Big*South to North&Finance Bureau Post $2016-01-09 12:25:59!,
10414#Big*South to North&Finance Bureau Post $2016-01-16 15:10:50!,
10414#Big*East to West&Lixian Post$2016-01-10 08:38:32!,
09769#Big*South to North&drilling post$2016-02-14 11:37:14!,
66788#Big*South to North&Huibin Xigang$2016-02-12 08:58:32!,
09771#Big*South to North&Transportation Bureau Post $2016-01-02 11:57:24!,
09478#Big*South to North&Transportation Bureau Post $2016-01-08 10:23:55!,
09478#Big*South to North&Transportation Bureau Post $2016-01-08 15:54:59!,
08930#Big*West to East&Bank Post $2016-02-07 11:57:34!,
09653#Big*West to East&Bank Post $2016-02-25 21:25:35!,
16531#Big*West to East&job post $2016-02-09 13:29:34!,
12009#大*North to South&Technology Donggang $2016-02-27 10:57:45!,
60020#大*South to North&Liaohe Gang$2016-02-17 07:43:15!,
15950#Big*West to East&Liaohe Gang$2016-01-19 13:32:41!,
00385#Big*South to North&Finance Bureau Post $2016-03-08 09:23:06!,
61333#大*East to West&Huibin Xigang$2015-12-30 11:59:28!,
10934#Big*West to East&Transportation Bureau Post $2016-02-28 11:49:47!,
13989#Big*North to South&Oil Gang$2016-03-12 14:56:23!,
36533#Big*East to West&Drilling Post$2016-02-11 14:08:24!,
12203#Big*East to West&Drilling Post$2016-01-28 09:54:55!,
91659#大*East to West&Huibin Xigang$2016-01-15 10:12:55!,
03777#大*South to North&Huibin Xigang$2016-02-23 09:53:41!,
15287#大*South to North&Huibin Xigang$2016-03-14 09:27:48!,
11871#大*South to North&Huibin Xigang$2016-03-19 15:28:23!,
12788#Big*North to South&Transportation Bureau Post $2016-03-09 10:52:40!,
66788#Big*South to North&Heminggang$2016-01-09 09:18:15!,
66788#大*South to North&Heminggang$2016-02-08 09:45:15!,
66788#大*South to North&Heminggang$2016-02-15 08:47:01!,
66788#大*South to North&Heminggang$2016-02-15 10:56:57!,
10161#Big*West to East&Taishangang$2016-02-27 06:52:08!,
09771#Big*South to North&Wuchanggang $2016-03-02 06:54:44!,
50453#Big*South to North&Shengli Post$2016-03-12 19:05:56!,
10414#Big*South to North&Shengli Gang$2016-03-07 12:17:51!,
09771#大*South to North&Zhongjiegang$2016-03-04 13:49:09!,
09804#Big*South to North&Finance Bureau Post $2016-02-27 17:13:36!,


When reading this kind of file, my writing speed is not good,

How can I read faster? ?
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 11:45:02
| Show all posts
Help me see the code,
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 12:00:01
| Show all posts
shi ReadFromFile(void)
{
shi handle,i,j,k,f,flag=0;
unsigned char cc,name[20],filename[20];
unsigned char buffer[8];
unsigned char buffer1[8];

shi total,g=0;
Total_Type = 0;
itoa(FileNum,buffer,10);

buffer[strlen(buffer)]=0x0;
// Warning(10,20,buffer);
strcpy(filename,"license plate");
strcpy(buffer1,".txt");

buffer1[4]=0x0;
filename[strlen(filename)]=0x0;

strcat(filename,buffer);
filename[strlen(filename)]=0x0;
strcat(filename,buffer1);filename[strlen(filename)]=0x0;
// Warning(10,20,filename);
handle = ffopen(filename,"rb");

if(handle==-1) {Warning(30,40,"The license plate data read error!"); return 0;}
else
{
i=0;j=0;k=0;f=0;g=0;
cc=ffgetc(handle);
while(1)
{
if(cc==',')
{
cc=ffgetc(handle); k=0; j++; flag=0;


if((strcmp(Read_File[i][j].name0,Group[0].name))==0)
{f++;

strcpy(Read_CopyFile[i][g].name0,Read_File[i][j].name0);
strcpy(Read_CopyFile[i][g].name1,Read_File[i][j].name1);
strcpy(Read_CopyFile[i][g].name2,Read_File[i][j].name2);
strcpy(Read_CopyFile[i][g].name3,Read_File[i][j].name3);
strcpy(Read_CopyFile[i][g].name4,Read_File[i][j].name4);
strcpy(Read_CopyFile[i][g].name5,Read_File[i][j].name5);
Read_CopyFile[i][g].name0[strlen(Read_CopyFile[i][g].name0)]=0x0;
Read_CopyFile[i][g].name1[strlen(Read_CopyFile[i][g].name1)]=0x0;
Read_CopyFile[i][g].name2[strlen(Read_CopyFile[i][g].name2)]=0x0;
Read_CopyFile[i][g].name3[strlen(Read_CopyFile[i][g].name3)]=0x0;
Read_CopyFile[i][g].name4[strlen(Read_CopyFile[i][g].name4)]=0x0;
Read_CopyFile[i][g].name5[strlen(Read_CopyFile[i][g].name5)]=0x0;

g++;
}

Toto=f;
}
if(cc=='*') {cc=ffgetc(handle); k=0; flag=1;}
if(cc=='#') {cc=ffgetc(handle); k=0; flag=2;}
if(cc=='!') {cc=ffgetc(handle); k=0; flag=3;}
if(cc=='$') {cc=ffgetc(handle); k=0; flag=4;}
if(cc=='&') {cc=ffgetc(handle); k=0; flag=5;}

if(cc=='^') {cc=ffgetc(handle); i++; j=0; k=0;}
if(cc=='@') break;
if(flag==0) Read_File[i][j].name0[k]=cc;
else if(flag==1) Read_File[i][j].name1[k]=cc;
else if(flag==2) Read_File[i][j].name2[k]=cc;
else if(flag==3) Read_File[i][j].name3[k]=cc;
else if(flag==4) Read_File[i][j].name4[k]=cc;
else if(flag==5) Read_File[i][j].name5[k]=cc;
k++;
if(flag==0) Read_File[i][j].name0[k]=0x0;
else if(flag==1) Read_File[i][j].name1[k]=0x0;
else if(flag==2) Read_File[i][j].name2[k]=0x0;
else if(flag==3) Read_File[i][j].name3[k]=0x0;
else if(flag==4) Read_File[i][j].name4[k]=0x0;
else if(flag==5) Read_File[i][j].name5[k]=0x0;
if(ffeof(handle)) break;

cc=ffgetc(handle);
}
Total_Type=i;
}

ffclose(handle);
return Total_Type;
}
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 Spain

Post time: 2020-12-11 12:15:01
| Show all posts
Post the structure of shi
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 12:30:01
| Show all posts
shi is int

Do not care. .
Just write one for me in tc
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 12:45:01
| Show all posts
I am comparing the first field if it is equal, I will save the last few fields into the global array and then process. .

But my query is very slow, can you help me write it well? .

Check it out soon? ?
Reply

Use magic Report

0

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-12-11 13:00:01
| Show all posts
Can't see where it affects the speed
but
filename[strlen(filename)]=0x0;
Read_CopyFile[i][g].name5[strlen(Read_CopyFile[i][g].name5)]=0x0;
Such statements should be deleteable
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 13:15:01
| Show all posts
Is there any other way to hurry up?
It's too slow
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-12-11 13:30:01
| Show all posts
If you can use multithreading, it would be great,
You can build a watch and read it while looking for it, which is very convenient
Or read it into the memory all at once, and then search.
Reply

Use magic Report

2

Threads

10

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-12-11 13:45:01
| Show all posts
Hey. . . . . . . . . . . . . . . . .
I'm so depressed.
Is there no good way to use c language? I can't use c.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list