Portability is an important issue to keep in mind when using the fread() and fwrite() functions across multiple systems. In particular, it is never guaranteed that reading or writing of simple data structures such as int's, let alone complex structures such as float's or struct's will preserve the representation or value of the data. Different compilers use different amounts of padding, different machines use various floating point models, may use a different number of bits per byte, and there is always the issue of endianness.
Non-compliant Code Example
struct {
char c;
float f;
} myData;
/* There is no way to verify what binary model was used to write the data */
fread(&myData, sizeof(myData), 1, fd);
Compliant Solution
The best solution is to use a text representation for the data.
struct {
char c;
float f;
} myData;
if(fscanf(fd, "%c %f\n", &myData.c, &myData.f) != 2) {
/* Handle error */
}