现在的位置: 首页 > 综合 > 正文

CString::GetLength()总是返回0

2013年01月23日 ⁄ 综合 ⁄ 共 303字 ⁄ 字号 评论关闭

 

CString

昨日调试代码发现CString::GetLength()函数总是返回0?百思不得其解。

原来:在这之前调用了GetBuffer(int nMinBufLength ),CSDN上关于GetBuffer(int
nMinBufLength ),有以下说明:

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

因此在调用GetLength()之前调用一下ReleaseBuffer()即可。

抱歉!评论已关闭.