剣は2サードパーティ製のライブラリを導入しました

/ * UUID発生* / 

の#include <stdio.hに> 
する#include <STDLIB.H>   / * のcalloc()関数ヘッダ* / 
の#include <assert.h> 
の#include " uuid.h " 

ボイド試験()
{ 
    uuid_t UUID; 
    CHAR * PCOUT = NULL; 

    / * 
    説明:
        UUIDは、典型的には36バイトである
    * / 

    // 1割り当てるメモリ 
    PCOUT =(チャー *)のcalloc37はsizeofCHAR )); 
    アサート(PCOUT); 

    / / 2. UUIDを作成します
    uuid_generate(UUID); 

    // 3.文字列に変換
    uuid_unparse(UUID、PCOUT); 

    // 4.プリントUUID 
    のprintf(" ==== UUID [%S] ==== \ N- " 、PCOUT); 

    / / リリースメモリ
    フリー(PCOUT); 
    PCOUT = NULL; 

} 

int型のmain()
{ 
    テスト(); 
    戻り 0 ; 
}

 

おすすめ

転載: www.cnblogs.com/zhanggaofeng/p/11666066.html