1 _finddata_t file;
2
3 char* szFilePack="F:\\RTMFP\\measurement data\\ME4\\recursive2\\lossbyte\\*.txt";
4 long lf;
5 if ((lf=_findfirst(szFilePack,&file))==-1)//==优先级较高所以要加括号,找到文件夹下面第一个符合的文件
6 {
7 cout<<"cannot find file"<<endl;
8 }
9 else
10 {
11 cout<<"1111 "<<file.name<<endl;
12 ifstream infile("F:\\RTMFP\\measurement data\\ME4\\recursive2\\lossbyte\\"+string(file.name));
13 if (infile==0)
14 cout<<"infile open failed! "<<file.name<<endl;
15 else
16 {
17 //cout<<"1111 "<<file.name<<endl;
18 int lossb=0;
19 string line,word;
20 istringstream linestream;
21 while(getline(infile,line))
22 {
23 linestream=istringstream(line);
24 linestream>>word;
25 linestream>>word;
26 linestream>>word;
27 lossb+=atoi(word.c_str());
28 }
29 lossbytes[file.name]=lossb;
30 // cout<<_findnext(lf,&file)<<endl;
31
32 while(_findnext(lf,&file)==0)
33 {
34 cout<<"1111 "<<file.name<<endl;
35 //cin>>x;
36 int lossb=0;
37 string line,word;
38 ifstream infile("F:\\RTMFP\\measurement data\\ME4\\recursive2\\lossbyte\\"+string(file.name));
39 istringstream linestream;
40 while(getline(infile,line))
41 {
42 linestream=istringstream(line);
43 linestream>>word;
44 linestream>>word;
45 linestream>>word;
46 lossb+=atoi(word.c_str());
47 }
48 lossbytes[file.name]=lossb;
49 }
50 }
51 }