Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 Java 代码中将一个长值放入一个字节数组中。这个(字节数组)将被传输到本机端代码(C++)。在这个 C++ 代码中,我必须重构从 Java 发送的长值。
如何访问字节数组及其中的所有字节并取回长值?请帮忙。
像这样的长期价值:
int64_t i; memcpy(&i, transmittedByteArray, 8); constexpr union { unsigned short s; unsigned char islittle;} chkendian{1}; if(chkendian.islittle) std::reverse((char*)&i,(char*)&i+8);