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()即可。