#include <iostream>#include <fstream>#include <string>using namespace std;int main(){ fstream inputFile("test.txt", ios::in); if (inputFile.good()) { string bufffer; string resultStr; inputFile.seekg(ios::beg); while(!inputFile.eof()) { getline(inputFile, bufffer, "\n"); resultStr.append(bufffer); resultStr.append("\r\n"); } inputFile.close(); fstream outputFile("result.txt", ios::app | ios::out); if (outputFile.good()) { outputFile.seekp(ios::beg); _strupr(const_cast<char*>(resultStr.c_str())); outputFile.write(resultStr.c_str(), resultStr.size()); outputFile.close(); } } system("pause"); return 0;}
#include <iostream>#include <fstream>#include <string>using namespace std;int main(){ fstream inputFile("test.txt", ios::in); if (inputFile.good()) { string bufffer; string resultStr; inputFile.seekg(ios::beg); while(!inputFile.eof()) { getline(inputFile, bufffer, "\n"); resultStr.append(bufffer); resultStr.append("\r\n"); } inputFile.close(); fstream outputFile("result.txt", ios::app | ios::out); if (outputFile.good()) { outputFile.seekp(ios::beg); _strupr(const_cast<char*>(resultStr.c_str())); outputFile.write(resultStr.c_str(), resultStr.size()); outputFile.close(); } } system("pause"); return 0;}