Format()を使用する必要があるプログラムがあります。文字列リテラルとintをCString変数に結合する関数。私はこれを行うためのいくつかの異なる方法を試しました、それらのコードはここにあります:
// declare variables used
CString _CString;
int _int;
// try to use format function with string literal
_CString.Format("text",_int);
// try to use format function with C-Style cast
_CString.Format((wchar_t)"text",_int);
// try to use format function with static_cast
_CString.Format(static_cast<wchar_t>("text"),_int);
最初のものはエラーC2664を返します:'void ATL :: CStringT :: Format(const wchar_t *、...)':パラメータ1を'constchar[33]'から'constwchar_t*'に変換できません
2つ目は、エラーはありませんが、テキストは漢字で表示されます。
3番目はエラーC2440を返します:'static_cast':'constchar[33]'から'wchar_t'に変換できません
CStringsをwchar_t*sに変換するためのアイデアはありますか?
ありがとう