0

Hello I have an array of structures that I am trying to write to a bin file. However I can only get the 'name' data to show. correctly.the rest comes out as illegible garbage .

 struct employee
    {
       char name[15];
        float sal, rate, raise, newsal;
    }e;

Here is my savebin function to save to the bin file.

void savebin(struct employee e[], int n)
    {
        FILE *f;
       f=fopen("c:\\cfiles\\employee2.text", "wb");
        fwrite(&e, sizeof(struct employee),n,f);
        fclose(f);
    }
user2736738
  • 30,591
  • 5
  • 42
  • 56

0 Answers0