I'm working on an application that needs to convert an array of four hex bytes i.e. 'A1 B2 C3 D4' into an integer (in that case 2712847316). I also have to do this in the other direction (integer into 4 bytes). It doesn't need to come out as hex, I just need to maintain the overall 32 bit data value and split it into 4 bytes.
I'm afraid I'm a little stuck (haven't programmed for a few years) and could do with some help.
It may be useful for you to know that this is being written as an 'S-Function' in Matlab so does not work as a 'standard' C code, essentially I'd prefer not to have to do the conversion in a seperate function / procedure but do everything in the main().
Thank you for your interest,