【发布时间】:2011-12-31 01:49:52
【问题描述】:
我正在尝试将两个整数值存储到 C++ 中的 char 数组中。 这是代码..
char data[20];
*data = static_cast <char> (time_delay); //time_delay is of int type
*(data + sizeof(int)) = static_cast<char> (wakeup_code); //wakeup_code is of int type
现在在程序的另一端,我想反转这个操作。也就是说,我需要从这个char数组中获取time_delay和wakeup_code的值。
我该怎么做??
谢谢, 尼克
P.S:我知道这是一种愚蠢的做法,但请相信我这是一种约束。
【问题讨论】: