forked from natto1784/ooplab
31
lab10/29.cpp
Normal file
31
lab10/29.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
const string SRC_FILE_PATH = "./29.in";
|
||||
const string DST_FILE_PATH = "./29.out";
|
||||
|
||||
int main() {
|
||||
string line;
|
||||
|
||||
fstream src, dst;
|
||||
src.open(SRC_FILE_PATH, ios_base::in);
|
||||
dst.open(DST_FILE_PATH, ios_base::out);
|
||||
dst.close();
|
||||
dst.open(DST_FILE_PATH, ios_base::app);
|
||||
|
||||
if (!src.is_open())
|
||||
exit(1);
|
||||
|
||||
while (getline(src, line)) {
|
||||
dst << line;
|
||||
if (src.peek() != EOF) {
|
||||
dst << endl;
|
||||
}
|
||||
}
|
||||
|
||||
src.close();
|
||||
dst.close();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user