首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

纠结的小疑点

2012-09-04 
纠结的小问题.C/C++ codefor(int nBtn 0nBtn 12 nBtn++){CString m_strIndex[12]wchar_t Tempm_str

纠结的小问题.

C/C++ code
    for(int nBtn = 0;nBtn < 12; nBtn++)    {        CString m_strIndex[12];        wchar_t Tempm_strIndex[30];        wcscpy(GPSData.Tempm_strIndex[nBtn],m_strIndex[nBtn]);    }


错误提示:
error C2664: 'wcscpy' : cannot convert parameter 1 from 'wchar_t' to 'wchar_t *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

wchar_t Tempm_strIndex[30];
是GPSData结构体中的一个.

[解决办法]
for(int nBtn = 0;nBtn < 12; nBtn++)
{
CString m_strIndex[12];
wchar_t Tempm_strIndex[30];
GPSData.Tempm_strIndex[nBtn]=m_strIndex[nBtn];
}


[解决办法]
探讨

引用:

error C2664: 'wcscpy' : cannot convert parameter 1 from 'wchar_t' to 'wchar_t *'
错误说的很清楚嘛,Tempm_strIndex[30]是wchar_t型,而wcscpy函数出入的应该是'wchar_t *',即传入的应该是wchar_t类型的指针。
还有一个挺奇怪,你是定义了wc……

热点排行