Does stringstream.read() consume the stream?
问题 I can't tell from the documentation how std::stringstream.read() works. Does it consume the stream or not? In other words: std::stringstream ss; char buffer[6]; ss << "Hello world!"; ss.read(buffer, 6); std::cout << ss.str(); // Is this "Hello world!" or just "world!" 回答1: The member std::istream::read() advances the stream position for as many characters it returns. I guess, this is what you mean with "consuming the stream". After reading 6 characters from ss , the next character read will