我想將uint8
轉換爲string
以將其與另一個進行比較。我的功能得到我的Mac Address
,現在我想保存在一個字符串。將uint8轉換爲字符串
int main(int argc, char *argv[])
{
kern_return_t kernResult = KERN_SUCCESS;
io_iterator_t intfIterator;
UInt8 MACAddress[kIOEthernetAddressSize];
kernResult = FindEthernetInterfaces(&intfIterator);
if (KERN_SUCCESS != kernResult) {
// printf("FindEthernetInterfaces returned 0x%08x\n", kernResult);
}
else {
kernResult = GetMACAddress(intfIterator, MACAddress, sizeof(MACAddress));
if (KERN_SUCCESS != kernResult) {
// printf("GetMACAddress returned 0x%08x\n", kernResult);
}
else {
printf("This system's built-in MAC address is %02x:%02x:%02x:%02x:%02x:%02x.\n",
MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], MACAddress[4], MACAddress[5]);
}
}
(void) IOObjectRelease(intfIterator); // Release the iterator.
return kernResult;
}
我該怎麼辦?我一直在尋找幫助,但沒有任何工作。我在Xcode上。
[性病:: to_string(http://www.cplusplus.com/reference/串/ to_string /)? –
你需要轉換嗎?你不能只比較一下'UInt8'的數組嗎? –