那位帮忙看看这个为什么打不开文件
已知 F: 盘存在 IN.TXT OUT.TXT I.TXT O.TXT
int main(void){ ifstream infile; ofstream outfile; vector<string> fin; fin.push_back("F:\\IN.TXT"); fin.push_back("F:\\I.TXT"); vector<string> fout; fout.push_back("F:\\OUT.TXT"); fout.push_back("F:\\O.TXT"); string str; vector<string>::iterator begin = fin.begin(); vector<string>::iterator begout = fout.begin(); while ( begin != fin.end() ) //简便起见,假设 fin 和 out 具有相同个数元素 { infile.open(begin->c_str()); if (!infile) //程序运行到此结束,返回值为 1 return infile.fail(); outfile.open(begout->c_str()); if (!outfile) return outfile.fail(); string str; while ( infile >> str) { outfile << str; if ( !infile.eof() ) outfile << endl; } begin++; begout++; infile.close(); outfile.close(); infile.clear(); outfile.clear(); } }