zoukankan      html  css  js  c++  java
  • c++ buf 转 hex,内存转十六进制文本

    int BufToHex(char* pBuf, int iLen, string& strOut)
    {
      strOut.clear();
      if (NULL == pBuf || iLen < 1)
      {
        return TRUE;
      }

      char szTmp[4] = { 0 };
      strOut.reserve(128 + iLen * 3);
      for (int i = 0; i < iLen; i++)
      {
        ZeroMemory(szTmp, sizeof(szTmp));
        sprintf(szTmp, "%02X ", static_cast<BYTE>(pBuf[i]));
        strOut.append(szTmp);
      }

      return TRUE;
    }

  • 相关阅读:
    if 语句
    变量命名
    python变量
    运算符
    注释
    PyCharm
    python版本,执行
    Tornado 【简述】
    Git 【管理篇】
    MySQL的介绍
  • 原文地址:https://www.cnblogs.com/longma8586/p/13861062.html
Copyright © 2011-2022 走看看