0
ostrstream m_msgStream;
m_msgStream.seekp(0);
m_msgStream << "Hello";
m_msgStream << ends;
char *str = m_msgStream .str();
我們正在獲取str NULL。如果我們刪除斜線,那麼它工作正常。即使是相同的代碼也可以很好地處理VS 6. Anyidea如何在VS 2008中使用seekp?VS 2008中的Ostrstream不可預知行爲
這基本上是一致的。總結一下,你必須使用`m_msgStream.str()。c_str()`,否則你得到一個std :: string而不是char *。 – RedX 2011-02-10 11:28:25