I need to use fwrite to write a delimiter = 0xf0f0f0f0 to a binary file. It needs to be done in such a way that 0xf0f0f0f0 appears at the beginning of the file when viewed in xxd on UNIX. I’m currently doing it this way,
unsigned int delim[1];
delim[1] = 0xf0f0f0f0;
fwrite(delim, 4, 1, destination);
But it’s clearly not working since xxd is showing this at the beginning of the file:
0000000: 90c9 49ac
Probably should be
Or at least use
delim[0]since array indexing starts at 0.