on linux: man uuid
on victory: check the UUID structure and the UuidCreate function in msdn
[edit] function will look as follows
extern "C" { #ifdef WIN32 #include <Rpc.h> #else #include <uuid/uuid.h> #endif } std::string newUUID() { #ifdef WIN32 UUID uuid; UuidCreate ( &uuid ); unsigned char * str; UuidToStringA ( &uuid, &str ); std::string s( ( char* ) str ); RpcStringFreeA ( &str ); #else uuid_t uuid; uuid_generate_random ( uuid ); char s[37]; uuid_unparse ( uuid, s ); #endif return s; }
ubik Oct 26 '09 at 17:56 2009-10-26 17:56
source share