lab 10: init

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-12-26 18:38:55 +05:30
parent 42902fa122
commit 9e7cffdc32
9 changed files with 298 additions and 2 deletions

31
lab10/29.cpp Normal file
View 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;
}