cstring的话 就比较方便了现在在win32 下 用哪个呢?char *imgeFileName = "111";
char *imgeFileName2 = "2222";
strcat(imgeFileName,imgeFileName2);MessageBox((LPCTSTR)imgeFileName,L"标题",64);这样会出错
char *imgeFileName2 = "2222";
strcat(imgeFileName,imgeFileName2);MessageBox((LPCTSTR)imgeFileName,L"标题",64);这样会出错
解决方案 »
- 四个小三角了 加油之
- VC6.0中连接数据库出问题!在线等待!
- VC6.0安装问题-->>>>紧急
- 有没有图形类型的开源项目??急!!!
- 求助:关于DispatchMessage()这个函数,如果一个进程中有两个窗口,那DispatchMessage()是如何知道奖消息发到哪个窗口?
- 帮忙解决两个题目
- 用VC如何读取网卡的MAC地址?能否将此网卡的MAC地址作为软件防拷贝的手段?(请教高手)
- ds
- 关于边缘检测的问题(求坐标点)
- 关于COM、ActiveX和IE的问题。
- Windows注册表当中,有没有"默认名称空间"和"应用程序名称空间"的区别?
- 我在WinMain中嵌入了几行汇编,结果一运行就报错。为什么?
char *imgeFileName2 = "2222";
strcat(imgeFileName,imgeFileName2);
-------------------------------------
囧
指针指向字符串常量,不允许改变其内容
char imgeFileName2[5] = "2222";
strcat(imgeFileName,imgeFileName2);
using namespace std;
...
...
...string imageFileName = "111";
string imageFileName2 = "2222";
imageFileName += imageFileName2;MessageBox((LPCTSTR)imageFileName.c_str(),L"标题",64);
char *imgeFileName2 = "2222";
strcat(imgeFileName,imgeFileName2);strcat函数执行会出错的,imgeFileName和imgeFileName2指针已经分配了固定的内存空间(指向了字符串常量),就不许更改了,如果不用CString,可以用std中的string.
char imgeFileName[8] = "111";
char imgeFileName2[5] = "2222";
strcat(imgeFileName,imgeFileName2);
MessageBox((LPCTSTR)imgeFileName,L"标题",64);
为什么乱码呢?
因为编码格式不同wchar_t imgeFileName[8] = L"111";
wchar_t imgeFileName2[5] = L"2222";
wcscat(imgeFileName,imgeFileName2);
MessageBox((LPCTSTR)imgeFileName,L"标题",64);这样全用宽字符应该就没问题了