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

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation