64,654
社区成员
发帖
与我相关
我的任务
分享
std::wstring m_DCMetadataTag;
TCHAR* CharToTChar(char* szInput)
{
_ASSERT(szInput);
#ifdef _UNICODE
return CharToWChar(szInput);
#else
char* szTmp=new char[strlen(szInput)+1];
if(!szTmp)
return 0;
::strcpy(szTmp,szInput);
return szTmp;
#endif
}
void MyParser::startElementHandler(const char *tag, const char **xmlattributes)
{
TCHAR **xmlAtts = NULL;
int i = 0;
while (xmlattributes[i] && *xmlattributes[i] && xmlattributes[i][0] != 0)
{
int iLen = strlen(xmlattributes[i]);
pAtts = new char[iLen+1];
strcpy(pAtts, xmlattributes[i]);
//////////////
//CharToTChar(char* szInput)可成功转换
这里应该对 TCHAR **xmlAtts如何处理?
//////////////
i++;
}
m_mapIdToHref.insert(pair<wstring, wstring>(xmlAtts [1],xmlAtts [3]));
}
template<T>
struct remove_const;
template<>
struct remove_const<const char**>
{
typedef char** type;
};
template<T>
struct remove_const;
template<>
struct remove_const<const T**>
{
typedef T** type;
};
#include <iostream>
#include <typeinfo>
using namespace std;
int main()
{
const char* * p;
cout << typeid(p[0]).name() << endl;
cout << typeid(const_cast<char*>(p[0])).name() << endl;
return 0;
}