Files
ooplab/lab10/29.cpp
Amneesh Singh 9e7cffdc32 lab 10: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-26 18:38:55 +05:30

32 lines
521 B
C++

#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;
}