read
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
std::ifstream in("some.file"); | |
std::istreambuf_iterator<char> beg(in), end; | |
std::string str(beg, end); | |
// or | |
std::ifstream in("some.file"); | |
std::ostringstream tmp; | |
tmp << in.rdbuf(); | |
std::string str = tmp.str(); | |
// 读取文件并按行遍历 | |
std::ifstream in("some.file"); | |
std::string line; | |
while(std::getline(in,line)) | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment