-
Notifications
You must be signed in to change notification settings - Fork 0
/
filehandling.cpp
53 lines (43 loc) · 945 Bytes
/
filehandling.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Created by ironwalrus on 7/5/20.
//
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
int main(){
string quoteOfTheDay = " Fuck my life man";
ofstream writer("qotd.txt");
if (!writer){
cout << "Error Opening File" << endl;
return -1;
}
else{
writer << quoteOfTheDay << endl;
writer.close();
}
ofstream writer2("qotd.txt", ios::app);
if (!writer2){
cout << "Error Opening File" << endl;
return -1;
}
else{
writer2 << "\n - Wooosh appended" << endl;
writer2.close();
}
char letter;
ifstream roder("qotd.txt");
if (!roder){
cout << "Error Opening File" << endl;
return -1;
}
else{
for (int i = 0; !roder.eof(); i++){
roder.get(letter);
cout << letter;
}
cout << endl;
roder.close();
}
return 0;
}