Sep 24, 2008 18:08
Полезные записки для себя.
#ifndef WIN32
#include
#else
#include
#endif
void UUID(char* outUUID /*buffer 37 byte*/)
{
unsigned char uuid[16];
#ifndef WIN32
uuid_t u;
uuid_generate(u);
memcpy((void *)uuid, (void *)u, 16);
#else
GUID u;
CoCreateGuid(&u);
memcpy((void *)uuid, (void *)&u, 16);
#endif
sprintf(outUUID, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
}
code