When i try to read back individual fields from the file i don't get the id,age, or salary. I figure its writing the address of the floats and ints but idk how to fix this or what to do.
Ive tried everything if any one has suggestions they would be appreciated.
The problem you are having is not with reading the data from the file, it's how you print that data after you have read it in. You are printing out the value of the class byte-by-byte, so any fields in your class that have multi-byte types will not be printed correctly (int and float are typically 4 bytes each). Instead of loading the data from the file into an array of chars, try allocating memory for an instance of the employee class, then passing a pointer to that to the read function. Then you can access the members of that class as the appropriate types. Something like this: