摘要:
看这段代码:... map mapAllVolumes; vector vecCheckedVolumes; CString cstrVolDesc; for(int i = 'c'; i (toupper(i), label)); //key using UpperCase }...结果:map里面所有key对应的都是最后一个插入的value再看下一段代码: CString str1; str1 = "C::::::::::"; mapAllVolumes.insert(map::value_type('C', str1.GetBuffer 阅读全文
posted @ 2013-11-20 19:25
Tup
阅读(2457)
评论(0)
推荐(0)
摘要:
wcscpy_s是对应于wcscpy的安全版本。CString cstrVolDesc;wchar_t* label = new wchar_t[100];....//wcscpy_s(label, cstrVolDesc.GetLength(), cstrVolDesc.GetString());//error:"Buffer too small"wcscpy_s(label, cstrVolDesc.GetLength()+1, cstrVolDesc.GetString());..可见,使用wcscpy_s一定要保证目标字符串的大小一定要比源字符串大,而且第二个参数指 阅读全文
posted @ 2013-11-20 19:10
Tup
阅读(2002)
评论(0)
推荐(0)
摘要:
memcpy是物理层次的复制 不管你类型是否统一 我就给你复制了^0^这里探讨下常见的情况:实例1: (LPCWSTR-->LPWSTR) ... LPCWSTR strConst = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; LPWSTR strNormal = new WCHAR[50]; memcpy(strNormal, strConst, 10);//乱码 ... 这说明:从小的size复制到大的size,只复制少部分字符,是不行的。实例2: (LPCWSTR-->LPWSTR) ... LPCWSTR strConst = L&q 阅读全文
posted @ 2013-11-20 19:03
Tup
阅读(369)
评论(0)
推荐(0)
摘要:
CString是微软程序员的偏爱,用不好也会让你很头疼,又爱又恨啊。主要实现在三个文件中atlstr.h cstringt.h atlsimpstr.h, atlsimpstr.h负责最基本的设计,cstringt.h则负责一些高级函数的实现,atlstr.h负责最后的封装。如果在非MFC工程中使用CString的,主要#include 就足够了。看到这段代码,挺有意思^0^templateclass ChTraitsBase{public: typedef char XCHAR; typedef LPSTR PXSTR; typedef LPCSTR PCXSTR; typedef wch. 阅读全文
posted @ 2013-11-20 16:04
Tup
阅读(713)
评论(0)
推荐(0)

浙公网安备 33010602011771号