When you write a byte as a byte (instead of first converting it to a string) it only uses 1 "character" of a file, just like it occupies 1 byte of RAM.
For an integer 32, it writes 4 bytes even though it could be a 10-digit decimal number when converted to a string.
In both cases, you must read it back the same way that you wrote it.
// size_t fwrite( const void *buffer, size_t size, size_t count, FILE *stream );
int32 foo ; // replace int32 with whatever your compiler uses for 32-bit integer
foo = 1234567890 ;
fwrite ( &foo , 4, 1, my_stream ) ; // should really be sizeof( int32 ) not 4
nb = fread ( &foo, 4, 1, my_stream ) ;