Created
September 6, 2016 06:15
-
-
Save wohhie/8e937bb2c799f0bdab981d6901b1dbcf to your computer and use it in GitHub Desktop.
Create File & Read File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() { | |
ofstream myfile("wohhie.txt"); | |
if (myfile.is_open()) { | |
myfile << "This is Line 1\n"; | |
myfile << "This is line 2\n"; | |
myfile.close(); | |
} | |
else { | |
cout << "Unable to write."; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment