Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- int main(){
- char filename[200];
- char output[100];
- cout << "Enter a file name and press ENTER: " << endl;
- cin.getline(filename, 200);
- ofstream file_out(filename);
- cout << filename << " was opened. Enter a line to enter and press ENTER(type @@@ to exit): " << endl;
- cin.getline(output, 100);
- if(! file_out){
- cout << filename << " could not be opened." << endl;
- return -1;
- }
- while(true){
- if(strcmp(output, "@@@"))
- break;
- file_out << output << endl;
- }
- file_out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement