如果我有以下 UUID 结构:
typedef unsigned long unsigned32;
typedef unsigned short unsigned16;
typedef unsigned char unsigned8;
typedef unsigned char byte;
typedef struct {
unsigned32 time_low;
unsigned16 time_mid;
unsigned16 time_hi_and_version;
unsigned8 clock_seq_hi_and_reserved;
unsigned8 clock_seq_low;
byte node[6];
} uuid_t;
是否可以将其表示为字符?如:
unsigned char uuid[128];
如果是这种情况,我将如何操纵以下值:
uuid.time_low = htonl(uuid.time_low); //uuid[0...32] = htonl(uuid[0...32])?
uuid.time_mid = htons(uuid.time_mid); //uuid[33...48] = htonl(uuid[33...48])?
uuid.time_hi_and_version = htons(uuid.time_hi_and_version); //uuid[49...64] = htonl(uuid[49...64])?
所以我的问题是,我将如何在实际代码中实际实现以下示例:
uuid[0...32] = htonl(uuid[0...32])
我在正确的轨道上吗?任何建议都非常感谢!