ITeye博客

CString 诡异的 GetLength() 返回 0

msnvip · 2009-01-21 17:55 · c/c++ · Markdown

如果CString是从GetPrivateProfileStr()返回的 记得return 该CString 前 释放buffer 要不,CString.GetLength()将返回0 找了半天原因,

“If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before using any other CString member functions. ”

在i=m_SZFileName.GetLength()之前调用m_SZFileName.ReleaseBuffer()就可以了。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。