{"id":166,"date":"2010-10-19T10:32:30","date_gmt":"2010-10-19T02:32:30","guid":{"rendered":"http:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=166"},"modified":"2019-02-12T20:11:56","modified_gmt":"2019-02-12T12:11:56","slug":"linux%e7%b3%bb%e7%bb%9f%e4%ba%a7%e7%94%9fuuid%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/10\/19\/linux%e7%b3%bb%e7%bb%9f%e4%ba%a7%e7%94%9fuuid%e7%9a%84%e6%96%b9%e6%b3%95\/","title":{"rendered":"linux\u7cfb\u7edf\u4ea7\u751fUUID\u7684\u65b9\u6cd5"},"content":{"rendered":"<div id=\"_mcePaste\">1 #include &lt;stdio.h&gt;<\/div>\n<div id=\"_mcePaste\">2 #include &lt;time.h&gt;<\/div>\n<div id=\"_mcePaste\">3 #include &lt;stdlib.h&gt;<\/div>\n<div id=\"_mcePaste\">4 #include &lt;uuid\/uuid.h&gt;<\/div>\n<div id=\"_mcePaste\">5<\/div>\n<div id=\"_mcePaste\">6 void display_uuid(uuid_t uu)<\/div>\n<div id=\"_mcePaste\">7 {<\/div>\n<div id=\"_mcePaste\">8 \u00a0 \u00a0 int i=0;<\/div>\n<div id=\"_mcePaste\">9 \u00a0 \u00a0 for(i=0; i&lt;16; i++)<\/div>\n<div id=\"_mcePaste\">10 \u00a0 \u00a0 {<\/div>\n<div id=\"_mcePaste\">11 \u00a0 \u00a0 \u00a0 \u00a0 printf(&#8220;%02x&#8221;, uu[i]);<\/div>\n<div id=\"_mcePaste\">12 \u00a0 \u00a0 }<\/div>\n<div id=\"_mcePaste\">13<\/div>\n<div id=\"_mcePaste\">14 \u00a0 \u00a0 printf(&#8220;\\n&#8221;);<\/div>\n<div id=\"_mcePaste\">15 }<\/div>\n<div id=\"_mcePaste\">16<\/div>\n<div id=\"_mcePaste\">17 int main()<\/div>\n<div id=\"_mcePaste\">18 {<\/div>\n<div id=\"_mcePaste\">19 \u00a0 \u00a0 uuid_t uu1, uu2;<\/div>\n<div id=\"_mcePaste\">20<\/div>\n<div id=\"_mcePaste\">21 \u00a0 \u00a0 uuid_generate(uu1);<\/div>\n<div id=\"_mcePaste\">22<\/div>\n<div id=\"_mcePaste\">23 \u00a0 \u00a0 uuid_generate(uu2);<\/div>\n<div id=\"_mcePaste\">24<\/div>\n<div id=\"_mcePaste\">25 \u00a0 \u00a0 display_uuid(uu1);<\/div>\n<div id=\"_mcePaste\">26<\/div>\n<div id=\"_mcePaste\">27 \u00a0 \u00a0 display_uuid(uu2);<\/div>\n<div id=\"_mcePaste\">28<\/div>\n<div id=\"_mcePaste\">29 \u00a0 \u00a0 int result = uuid_compare(uu1, uu2);<\/div>\n<div id=\"_mcePaste\">30<\/div>\n<div id=\"_mcePaste\">31 \u00a0 \u00a0 printf(&#8220;result = %d\\n&#8221;, result);<\/div>\n<div id=\"_mcePaste\">32<\/div>\n<div id=\"_mcePaste\">33 \u00a0 \u00a0 return 1;<\/div>\n<div id=\"_mcePaste\">34 }<\/div>\n<div><\/div>\n<div>\u7f16\u8bd1\u547d\u4ee4\uff1agcc demo.c -luuid<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1 #include &lt;stdio.h&gt; 2 #include &lt;time.h&gt; 3 #include &lt;stdlib.h&gt;&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2010\/10\/19\/linux%e7%b3%bb%e7%bb%9f%e4%ba%a7%e7%94%9fuuid%e7%9a%84%e6%96%b9%e6%b3%95\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[62],"class_list":["post-166","post","type-post","status-publish","format-standard","hentry","category-6","tag-uuid"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":3,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":1948,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/166\/revisions\/1948"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}