突然想到的问题,代码中用过,不是自己实现的。
这个问题有多简单,或者多难,打开vc试试
#include <iostream> int main() { int a = 0x01020304; std::cout << "current system is " << (*reinterpret_cast<char*>(&a) == 0x04 ? "little endian" : "big endian") << std::endl; }
比想象中简单多了!
突然想到的问题,代码中用过,不是自己实现的。
这个问题有多简单,或者多难,打开vc试试
#include <iostream> int main() { int a = 0x01020304; std::cout << "current system is " << (*reinterpret_cast<char*>(&a) == 0x04 ? "little endian" : "big endian") << std::endl; }
比想象中简单多了!