Best practice for writing 32-bit integers to files? C [closed]
There's a lot of file formats that require writing a set of integers to the file for various reasons. And I've recently found myself doing this
uint32_t u32;
u32 = ...
fwrite(&u32, 4, 1, file);
u32 = ...
fwrite(&u32, 4, 1, file);
...
which seems unnecessary and tedious. Is this a good practice? Or is there a better solution?
Comments
Post a Comment