fwrite a one byte integer
I'm making a program that edits a binary file. Most of this binary file is composed of single byte unsigned integers. At the moment, I'm making sure the values are validated to be within a single byte before writing them to the file, and I'm using unsigned shorts, since that's as small as I get get with an actual, real integer type. For number of bytes and elements to pass to fwrite, I'm just putting 1 for both (1 element, 1 byte) so that it just writes the first byte of the short, since as before, I've already validated the data by this point to be contained within that first byte.
Is there a better, safer, more legitimate way of writing one byte integer values to a binary file? Because my way seems kinda, I dunno, ghetto.
I'm reading the values from the file into unsigned char arrays, but I wasn't sure if writing them back the same way would work ok.
I tried googling around for it, but didn't come up with much, aside from some post I came across in the results that involved some combination of casting, int, char, and pointers, which I haven't been able to find again.