1. TCHAR的字符串怎么转换成wstring
这样应该可以
wstring ws;
TCHAR* t = (TCHAR*)(&ws[0]);
楼主试试看。
#include <string>
#include <tchar.h>
using namespace std;
int main()
{
string s;
wstring ws;
ws = L"OK";
TCHAR *tc = (TCHAR *)(&ws[0]);
return 0;
}
测试没有报错。
2. 字符串和DWORD类型之间如何相互转换
再把 dword转为字符串的也发出来
void HashToString(char *strHash,SHA1 hash,int iSize) //hash转成字符串
{
uchar *p=(uchar *)&hash;
char tmp[3]={0};
for (int j=0;j{
sprintf(tmp,"%02X",(uchar)p[j]);
//OutputDebugString(tmp);
strcat(strHash,tmp);
}
//OutputDebugString(strHash);
}
转载请注明出处51数据库 » dword转换wstring
能干吃康师傅的汉子