Created
March 30, 2022 04:10
-
-
Save a2gs/387052a033307cbfff36f028adbe9f82 to your computer and use it in GitHub Desktop.
UUID sample code // OSF DCE -- Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Andre Augusto Giannotti Scota (https://sites.google.com/view/a2gs/ andre.scota@gmail.com) */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <uuid/uuid.h> | |
int main(int argc, char *argv[]) { | |
uuid_t ctx_uuid; | |
char uuid[37] = {0}; | |
uuid_generate_random(ctx_uuid); | |
uuid_unparse_lower(ctx_uuid, uuid); | |
printf("UUID: [%s][%03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d]\n", uuid, | |
ctx_uuid[0], ctx_uuid[1], ctx_uuid[2], ctx_uuid[3], ctx_uuid[4], ctx_uuid[5], ctx_uuid[6], ctx_uuid[7], | |
ctx_uuid[8], ctx_uuid[9], ctx_uuid[10], ctx_uuid[11], ctx_uuid[12], ctx_uuid[13], ctx_uuid[14], ctx_uuid[15]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment