Created
September 6, 2016 06:17
-
-
Save wohhie/00007b466bb8c6fca9a51149bef6497e to your computer and use it in GitHub Desktop.
Read From 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> | |
#include <string> | |
using namespace std; | |
int main() { | |
string line; | |
ifstream myfile("wohhie.txt"); | |
if (myfile.is_open()) { | |
while (getline(myfile, line)) { | |
cout << line << endl; | |
} | |
} | |
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