开发者

Ostrstream unpredicted behavior in VS 2008

ostrstream  m_msgStream;
m_msgStream.seekp(0);
m_msgStream << "Hello";
m_msgStream << ends;
char *str = m_msgStream .str();

We are getting str NULL. If we remove th开发者_JAVA百科e skeep line then it working fine. Even the same code is working fine with VS 6. Anyidea how to use seekp in VS 2008?


ostrstream is deprecated. Use std::ostringstream instead.

#include <sstream>
std::ostringstream m_msgStream;
m_msgStream << "Hello";
std::string str = m_msgStream().str();
const char* cstr = str.c_str();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜