CString 赋值问题

来源:百度知道 编辑:UC知道 时间:2024/06/15 12:09:19
不好意思,,一急就忘了写下来了。。。

我写了一段程序,定义了三个CString 对象。
void CopenVMDlg::OnBnClickedButton7()
{
CString a="aa";
CString b("bb");
CString c="cc";
}

但是运行时观察到
a= "bb"
b="cc"

这是为什么呢? 是我机器的问题,还是VC2005的BUG?

我用VS2005中文版测试过没有发现问题。。。
不过如果在新建项目的时候如果选定了采用Unicode字符集就会发生编译错误,建议楼主检查一下设置

Searches this string for the first match of a character or substring.

int Find(
PCXSTR pszSub,
int iStart=0
) const throw( );
int Find(
XCHAR ch,
int iStart=0
) const throw( );

Parameters
pszSub
A substring to search for.

iStart
The index of the character in the string to begin the search with, or 0 to start from the beginning.

ch
A single character to search for.

====================
MSDN的讲解。。。

有什么问题?详细说说

查找该字符串第一个匹配的字符或子串
int Find( PCXSTR pszSub, int iStart=0 ) const throw( );
int Find( XCHAR ch, int iStart=0 ) const throw( );

Parameters //参数
pszSub
A substring to search for. //一个你要查找的子串
iStart
The index of the character in the string to begin the search with, or 0 to start from the beginning.