Sword introduced two third-party libraries

/ * UUID generated * / 

#include <stdio.h> 
#include <stdlib.h>   / * calloc () function headers * / 
#include <the assert.h> 
#include " uuid.h " 

void Test () 
{ 
    uuid_t UUID; 
    char * PCOUT = NULL; 

    / * 
    description: 
        UUID is typically 36 bytes 
    * / 

    // 1. allocate memory 
    PCOUT = ( char *) calloc ( 37 [ , the sizeof ( char )); 
    Assert (PCOUT); 

    / / 2. create uuid
    uuid_generate (UUID); 

    // 3. converted into a string 
    uuid_unparse (UUID, PCOUT); 

    // 4. Print UUID 
    the printf ( " ==== UUID [% S] ==== \ n- " , PCOUT); 

    / / The release memory 
    Free (PCOUT); 
    PCOUT = NULL; 

} 

int main () 
{ 
    Test (); 
    return  0 ; 
}

 

Guess you like

Origin www.cnblogs.com/zhanggaofeng/p/11666066.html