How to obtain UUID in Linux

Source: Internet
Author: User

GUID (Global unique identifier) isMicrosoftName of UUID.
UUID (universal unique identifier)

Uuidgen can be used on HP and RedHat for generation,SolarisCommand: makeuuid

How to use C ++ProgrammingObtain UUID?
1. Install the libuuid library. libuuid. so.1 is included in e2fsprogs.SystemFor redhat7.3, downloadFTP: // 194.199.20.114/Linux/RedHat/7.3/en/OS/i386/RedHat/RPMS/e2fsprogs-1.27-3.i386.rpm

2. EditFileUUID. cpp

# Include <iostream>;
# Include <stdio. h>;
# Include <UUID/UUID. h>;

Int main ()
{
Uuid_t Uu;
Uuid_generate (UU );
STD: cout <UU <STD: Endl;
Int I;
For (I = 0; I <16; I ++)
{
Printf ("% x", UU);
}
Printf ("\ n ");
Return 0;
}

# G ++-C-g uuid. o uuid. cpp
# G ++-o-luuid UUID. o

Specifically,/usr/include/UUID. H has the uuid_t definition:
Typedef unsigned char uuid_t [16];

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.