Created
December 5, 2011 05:50
-
-
Save xkyii/1432473 to your computer and use it in GitHub Desktop.
read
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 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