Utility function to save an uint32 to a file.
value to output
file to output to
0 on success, -1 on error.