generating uuids with uuid_gen ( libuuid )
hi!
i've been trying to generate uuids with the libuuid api. i've tried the following code many times and read through the man pages as many times.
i'm still getting the incorrect output format.
here's the code
/****************************************/
#include <stdio.h>
#include <uuid/uuid.h>
int main(){
char string[37];
uuid_t gen;
uuid_generate(gen);
uuid_unparse(gen, string);
printf("\n%08x-%04x-%04x-%04x-%012x", string);
}
/***************************************/
*i get an output that resembles:
bffff5f0-0097-40015a38-66323632-000038666139
*when it should look like (this is what i got using uuidgen) :
2b1fcb57-141d-4e12-91eb-237a242c72dc
i.e. the format is all messed up in the middle
am i missing something here??
please help me out !!
thanks a million
jetley
Last edited by jetley; 05-19-2004 at 12:58 PM.
|