I need to serialize a C struct to a file in a portable way, so that I can read the file on other machines and can be guaranteed that I will get the same thing t
struct
You could try using a library such as protocol buffers; rolling your own is probably not worth the effort.