char pMsg[100];
CString aa;
其中pMsg已经被赋值了,怎样把pMsg的值传给aa?
5 个解决方案
#1
我是菜鸟,刚学,也不知道用什么函数
不过我是这样做的:
aa="";
for (i=0;i<len;i++)
aa += pMsg[i];
不过我是这样做的:
aa="";
for (i=0;i<len;i++)
aa += pMsg[i];
#2
这个我觉得很太容易的,希望下面的代码能帮你!
char pMsg[100]
CString aa;
char* str=new char[101];
for (int i=0;i<100;i++)
p[i]=pMsg[i];
p[100]='\0';
aa=p;
你试试看吧,应该不会错的!
char pMsg[100]
CString aa;
char* str=new char[101];
for (int i=0;i<100;i++)
p[i]=pMsg[i];
p[100]='\0';
aa=p;
你试试看吧,应该不会错的!
#3
char szTmp[100] = {0};
CString str;
strcpy(str.GetBuffer(), szTmp, sizeof(szTmp));
CString str;
strcpy(str.GetBuffer(), szTmp, sizeof(szTmp));
#4
Writes formatted data to a CStringT in the same way that sprintf formats data into a C-style character array.
void __cdecl Format(
UINT nFormatID,
[, argument]...
);
void __cdecl Format(
PCXSTR pszFormat,
[, argument]...
);
Parameters
nFormatID
The string resource identifier that contains the format-control string.
pszFormat
A format-control string.
argument
Optional arguments.
void __cdecl Format(
UINT nFormatID,
[, argument]...
);
void __cdecl Format(
PCXSTR pszFormat,
[, argument]...
);
Parameters
nFormatID
The string resource identifier that contains the format-control string.
pszFormat
A format-control string.
argument
Optional arguments.
#5
aa.Format("%s",pMsg);
#1
我是菜鸟,刚学,也不知道用什么函数
不过我是这样做的:
aa="";
for (i=0;i<len;i++)
aa += pMsg[i];
不过我是这样做的:
aa="";
for (i=0;i<len;i++)
aa += pMsg[i];
#2
这个我觉得很太容易的,希望下面的代码能帮你!
char pMsg[100]
CString aa;
char* str=new char[101];
for (int i=0;i<100;i++)
p[i]=pMsg[i];
p[100]='\0';
aa=p;
你试试看吧,应该不会错的!
char pMsg[100]
CString aa;
char* str=new char[101];
for (int i=0;i<100;i++)
p[i]=pMsg[i];
p[100]='\0';
aa=p;
你试试看吧,应该不会错的!
#3
char szTmp[100] = {0};
CString str;
strcpy(str.GetBuffer(), szTmp, sizeof(szTmp));
CString str;
strcpy(str.GetBuffer(), szTmp, sizeof(szTmp));
#4
Writes formatted data to a CStringT in the same way that sprintf formats data into a C-style character array.
void __cdecl Format(
UINT nFormatID,
[, argument]...
);
void __cdecl Format(
PCXSTR pszFormat,
[, argument]...
);
Parameters
nFormatID
The string resource identifier that contains the format-control string.
pszFormat
A format-control string.
argument
Optional arguments.
void __cdecl Format(
UINT nFormatID,
[, argument]...
);
void __cdecl Format(
PCXSTR pszFormat,
[, argument]...
);
Parameters
nFormatID
The string resource identifier that contains the format-control string.
pszFormat
A format-control string.
argument
Optional arguments.
#5
aa.Format("%s",pMsg);