首页  

c语言获取UUID     所属分类 c 浏览量 710
UUID C库
http://linux.die.net/man/3/libuuid

uuidtest.c 



#include <stdio.h>
#include <uuid/uuid.h>

int main(int argc, char **argv){
  uuid_t uuid;
  char str[36];
  uuid_generate(uuid);
  uuid_unparse(uuid, str);
  printf("%s \n", str);
  return 0;
}



mac下 不需要 链接uuid库 
gcc uuidtest.c 

Linux 编译 链接uuid库
gcc uuidtest.c -luuid
uuidtest.c:3:23: 致命错误:uuid/uuid.h:没有那个文件或目录

yum install uuid uuid-devel
yum install libuuid libuuid-devel

gcc uuidtest.c -luuid 
编译ok

./a.out
09425627-aad0-4789-8209-4ccf00dae299 


https://gitee.com/dyyx/hellocode/blob/master/web/tech/c/demo/uuidtest.c
uuid 命令 man uuid # generate DCE 1.1 v1 UUID (time and node based) uuid -v1 01c47915-4777-11d8-bc70-0090272ff725 # generate DCE 1.1 v3 UUID (name based) uuid -v3 ns:URL http://codefun007.xyz/ c638027d-1d84-3ea0-ac14-90b1dc381bfc # generate DCE 1.1 v4 UUID 4 (random data based) uuid -v4 eb424026-6f54-4ef8-a4d0-bb658a1fc6cf

上一篇     下一篇
go.sum 生成

go google uuid 例子

java hex util

UUID简介

temporal 获取集群信息 关键代码

postgresql jdbc 驱动 ResultSet 取值