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;
};