Created
December 4, 2017 04:54
-
-
Save lniwn/39c00cadbf07cf16c5f8dd7f084a7673 to your computer and use it in GitHub Desktop.
Read file-contents into a string in C++
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
std::ifstream ifs("myfile.txt"); | |
std::string content( (std::istreambuf_iterator<char>(ifs) ), | |
(std::istreambuf_iterator<char>() ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment