 
                            Portability is an important issue to keep in mind a concern when using the fread() and fwrite() functions across multiple, heterogeneous systems. In particular, it is never guaranteed that reading or writing of simple scalar data structures types such as int'sintegers, let alone complex structures aggregate types such as float's or struct'sarrays or structures, will preserve the representation or value of the data. Different compilers use different amounts of padding. Different machines use various floating point models and may use a different number of bits per byte. In addition, there is always the issue of endianness.
Non-
...
Compliant Code Example
| Code Block | ||
|---|---|---|
| 
 | ||
| 
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);
 | 
...
| Code Block | ||
|---|---|---|
| 
 | ||
| 
struct {
    char c;
    float f;
} myData;
if (fscanf(fd, "%c %f\n", &myData.c, &myData.f) != 2) {
    /* Handle error */
}
 | 
Risk Assessment
...