MFC und atio geht nicht
-
int a,b,c; CString s= "22" ; a = atoi(s);
Die Sachen stehen in meinem Button1
[code]
error C2440: 'initializing' : cannot convert from 'const char [3]' to 'ATL::CStringT<BaseType,StringTraits>'
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> Constructor for class 'ATL::CStringT<BaseType,StringTraits>' is declared 'explicit'
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1>.\xxx.cpp(507) : error C2664: 'atoi' : cannot convert parameter 1 from 'CString' to 'const char *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
[cpp]
-
Stichwort TCHAR...
CString s = _T("22"); int a = _tstoi(s);
-
mega THX,
noch eine Frage:int aa = 25; CString strIrgendwas ; strIrgendwas.Format("%d", aa);
ich habe mehrere _T Kombinationen ausprobiert, geht irgendwie nicht.
-
int aa = 25; CString strIrgendwas ; strIrgendwas.Format(_T("%d"), aa);
Mit _T sollte es tun.
Oli_1977