Last active
March 24, 2018 07:30
-
-
Save cztchoice/40d4d3f23183413b7470982fead59d41 to your computer and use it in GitHub Desktop.
C++读取文件到string
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::ostringstream fileContentsStream; | |
fileContentsStream << std::ifstream("MyFile.txt").rdbuf(); | |
std::string fileContents = fileContentsStream.str(); |
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("D:/quote/beforetidy.html"); | |
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