VC++開發常用功能一系列文章 (歡迎訂閱,持續更新...)
給定一個字串,有時我們需要把它轉成16進制字串進行操作
比如: wifi的profile 中的SSID ,在操作時需要轉成16進制
如下面:
strssid.TrimLeft();
strssid.TrimRight();
CString tempstr = ConvertCStringoHex_ASCII(strssid);
strhexssid.Format("<hex>%s</hex> \n", tempstr);
本來就是一個wifi的名稱
但是需要轉成16進制 ,這是profile的格式要求:
直接上代碼:
CString ConvertCStringoHex_ASCII(CString Data)
{
//CString轉換成char[]
//TCHAR* a = Data.GetBuffer(Data.GetLength());
//int nLen = WideCharToMultiByte(CP_ACP, 0, a, -1, NULL, 0, NULL, NULL);
//if (nLen == 0)
//{
// return NULL;
//}
//char* pResult = new char[nLen];
char tagChar
CSDN認證博客專家
C/C++
vc/qt
音視頻
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/261800.html
標籤:其他
上一篇:GPS衛星軌道
