2

拥有char *及其int length如何将其深度复制到stringstream

4

3 回答 3

3

使用std::stringstream::write(s, length);.

请注意,如果可以使用char*is null 终止并且不需要提供:operator<<()length

std::stringstream s;
const char* buf = "hello";
s << buf;
于 2012-12-14T14:09:13.470 回答
1

不应该写完全满足您的要求吗?

http://www.cplusplus.com/reference/ostream/ostream/write/

于 2012-12-14T14:09:08.903 回答
1

你应该阅读文档这个

于 2012-12-14T14:09:55.623 回答