zoukankan      html  css  js  c++  java
  • GUID2stdstring

    int GUID2stdstring(GUID guid,std::string& str,int type=0)

    {

        std::stringstream ss;

       

        if(type==0)

        {

           int tmp;

           ss<<std::showbase<<std::hex<<std::internal<<setfill('0');  

          

           //memset(&guid,0,sizeof(guid));0输出不是0xffffffff..

           tmp=guid.Data1;

           if(tmp)

               ss<<std::setw(10)<<tmp;

           else

               ss<<"0x00000000";

           tmp=guid.Data2;

           tmp=0x20;

           if(tmp)

               ss<<","<<std::setw(6)<<tmp;

           else

               ss<<",0x0000";

           tmp=guid.Data3;

           if(tmp)

               ss<<","<<std::setw(6)<<tmp;

           else

               ss<<",0x0000";

           for(int i=0;i<sizeof(guid.Data4)/sizeof(guid.Data4[0]);++i)

           {

               tmp=guid.Data4[i];

               if(tmp)

                  ss<<","<<std::setw(4)<<tmp;

               else

                  ss<<",0x00";

           }

           str=ss.str();

          

          

        }

        return 0;

    };

  • 相关阅读:
    B-Tree索引的学习记录
    mysql NOW,CURRENT_TIMESTAMP,SYSDATE 之间的区别
    哈希索引
    MyISAM和InnoDB的区别
    负载均衡记录一
    哈希索引
    mysql ZEROFILL属性
    redis常用命令及使用场景
    js Function()构造函数
    书写闭包的时候需注意一下情况
  • 原文地址:https://www.cnblogs.com/iwasmu/p/1725785.html
Copyright © 2011-2022 走看看