uuidgen
% uuidgen 975DA04B-9A5A-4816-8780-C051E37D1414
如果您想将其构建到自己的应用程序或服务中,则需要libuuid:
libuuid
#include <uuid/uuid.h> #include <iostream> int main() { uuid_t uu; uuid_generate(uu); char uuid[37]; uuid_unparse(uu,uuid); std::cout << uuid << std::endl; }