本文共 541 字,大约阅读时间需要 1 分钟。
#include#include using namespace std;int main(){ ifstream infile, infile2; ofstream outfile; infile.open("code.txt", ios::binary); infile2.open("keywords.txt"); outfile.open("result.txt"); if (!infile) { cout << "找不到源文件\n"; return 0; } if (!infile2) { cout << "找不到关键字表\n"; return 0; } string str1, str2, str3; char* ch1, *ch2; //下面这三种情况都会报错,说没有重载>>和<< infile >> str1; outfile << str2; infile >> str3; //用char*进行读取是可以的 infile >> ch1; infile2 >> ch2; return 0;}
转载地址:http://jrftb.baihongyu.com/