【发布时间】:2021-03-13 03:11:08
【问题描述】:
比如说我有这个unsigned long long int:
unsigned long long int test_int = 0xcfffedefcfffeded; // 14987959699154922989
如何将test_int 转换为以下unsigned char* 数组:
unsigned char test_char[] = "\xcf\xff\xed\xef\xcf\xff\xed\xed";
与我问的这个问题类似: How to convert unsigned char* to unsigned long long int? 唯一的例外是反向。
【问题讨论】:
-
你试过什么?你做了什么研究?这个问题真的有必要吗?最后一个问题不是提示你怎么做吗?我什至链接了一个实现该转换的库 - 你研究过它吗?看看stackoverflow.com/questions/3784263/…。
-
我只是在得知您的示例有效后才看了一下,我会重新阅读它。
-
请原谅我,但是@github.com/biiont/gpsd/blob/master/bits.h#L45 上的哪一行?
-
注意:
"\xcf\xff\xed\xef\xcf\xff\xed\xed"是 9 的char数组。
标签: c type-conversion 64-bit unsigned-char unsigned-long-long-int