I'm trying to write a structure to a file, and read that structure in again, possibly with different padding, byte alignment, edianness, and platforms.

fread() and fwrite() don't work when writing the whole structure. Would they work when writing each member of the structure separately?

How could I write a short to a file? Would this work? Would it work only for unsigned shorts?
Code:
putc(s/256, fp);
putc(s%256, fp);
Can every possible value of a short be written in that way? eg, even ones that would write a '\n' to the file?

Is fwrite()ing a char okay? Even with different edians?