You could use the functions in arpa/inet.h to convert from host to network byte order, and back from network to host. Note that this is dependent on the length of the integer.
I don't know of any way to convert an arbitrary file, since a program that did that wouldn't know how the data is organized in the file. The inet.h also doesn't appear to have functions for 64-bit integers or floating point numbers, if that is an issue for you.
You might also want to look at http://www.codeguru.com/forum/showthread.php?t=292902
Edit: jkdaye beat me to it.