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"<>word;25 linestream>>word;26 linestream>>word;27 lossb+=atoi(word.c_str());28 }29 lossbytes[file.name]=lossb;30 // cout<<_findnext(lf,&file)< >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 }