This is the given question. Write a C program to write a 32 bit data (array of 10 numbers) in a big endian form to a file and read the same on a little endian machine. please help me with this one. i tried to make this function, to change the endianness but it is not working for array of 10 numbers. but it is working for 8 numbers.can you please tell me how to make this work for the array of 10 numbers. But uint32_t takes an array of 10 numbers, idk why its not working.
uint32_t ChangeEndianness(uint32_t u32Value)
{
uint32_t u32Result = 0;
u32Result |= (u32Value & 0x000000FF) << 24;
u32Result |= (u32Value & 0x0000FF00) << 8;
u32Result |= (u32Value & 0x00FF0000) >> 8;
u32Result |= (u32Value & 0xFF000000) >> 24;
return u32Result;
}
User contributions licensed under CC BY-SA 3.0