Modifying CString Contents Directly In most situations, you should use CString member functions to modify the contents of a CString object or to convert the CString to a C-style character string.However, there are certain situations, such as working with operating-system functions that require a character buffer, where it is advantageous to directly modify the CString contents.The GetBuffer and ReleaseBuffer member functions allow you to gain access to the internal character buffer of a CString object and modify it directly. The following steps show how to use these functions for this purpose: Call GetBuffer for a CString object and specify the length of the buffer you require.Use the pointer returned by GetBuffer to write characters directly into the CString object.Call ReleaseBuffer for the CString object to update all the internal CString state information, such as the length of the string. After modifying a CString object's contents directly, you must call ReleaseBuffer before calling any other CString member functions. 看看这个对你有帮助吗?
其实我描述的是个简化的错误。
程序一个是ado数据库程序。没有多余的DLL。
s = "离开家";
In most situations, you should use CString member functions to modify the contents of a CString object or to convert the CString to a C-style character string.However, there are certain situations, such as working with operating-system functions that require a character buffer, where it is advantageous to directly modify the CString contents.The GetBuffer and ReleaseBuffer member functions allow you to gain access to the internal character buffer of a CString object and modify it directly. The following steps show how to use these functions for this purpose: Call GetBuffer for a CString object and specify the length of the buffer you require.Use the pointer returned by GetBuffer to write characters directly into the CString object.Call ReleaseBuffer for the CString object to update all the internal CString state information, such as the length of the string. After modifying a CString object's contents directly, you must call ReleaseBuffer before calling any other CString member functions.
看看这个对你有帮助吗?