VS C++ 实现ifstream 读取txt文件并输出到txt
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
using namespace std;
int main(){
vector<string> noVerNumber_data;
vector<string> GameVerNumber_data , result;
ifstream inFile1,inFile2;
inFile1.open("D:\\cwwu\\testComplete\\testComplete\\data2.txt");
string str1;
if (inFile1){ //文件打开是否成功
cout << "endless.txt1 open scessful" << endl;
while (getline(inFile1, str1)){
noVerNumber_data.push_back(str1);
}
inFile1.close();
}
else
cout << "endless.txt doesn't exist" << endl;
inFile2.open("D:\\cwwu\\testComplete\\testComplete\\GameData.txt");
string str2;
if (inFile2){ //文件打开是否成功
cout << "endless.txt2 open scessful" << endl;
while (getline(inFile2, str2)){
GameVerNumber_data.p