Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- using namespace std;
- const int MAX_CHAR = 40;
- int main()
- {
- char file_sentance[MAX_CHAR];
- bool missingFile;
- ifstream fin;
- ofstream fout;
- fin.open("stuff1");
- missingFile = (fin.fail());
- if(!missingFile) {
- fout.open("stuff2", ios::app);
- missingFile = (fout.fail());
- if(!missingFile) {
- for(int i = 0, n = 1; !fin.eof(); i++, n++) {
- fin >> file_sentance[i];
- fout << file_sentance[i];
- if(n == 5) {
- fout << endl;
- n = 0;
- }
- }
- }
- }
- else {
- cout << "404 File not found\n";
- }
- fout.close();
- fin.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement