You need to convert a number from Little endian to big-endian .. Initially, a 32-bit number is given in decimal form .. You need to give a finite number, also in 10 form .. Suppose 3496683923 in 16 will look like D06B2993 .. We divide by bytes: D0 6B 29 93 .. Shift with respect to the ends .. 93 29 6B D0. We collect back the whole thing 93296BD0 and translate into 10 view: 2468965328.
If there is a simpler way, can you please explain? There is a sketch of the code that converts to the 16th system .. But I have no idea how to get this data from there and convert it to 10cc. (code is not mine, do not carp too much)
#include <iostream> #include <sstream> #include <string.h> using namespace std; int main() { string normal; int const Value = 3496683923; unsigned char const *pByte = (unsigned char const *)&Value; for (size_t i = 0; i < sizeof (Value); ++i) { cout << hex<< static_cast<int>(pByte[i]) << endl; } cout << endl; return 0; }