Created
June 13, 2011 20:35
-
-
Save bdesham/1023627 to your computer and use it in GitHub Desktop.
Read lines from a file in C++
This file contains 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
// <iostream> and <fstream> have been included | |
void lines() { | |
ifstream in_file; | |
in_file.open("input.txt"); | |
string line; | |
while (in_file.getline(line, 256)) { | |
cout << "line: \"" << line << "\"\n"; | |
} | |
in_file.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment