Encode a gint32, performing no compression, but converting to network order.
value to output
file to output to
0 on success, -1 on error.