JasBascom said:
if validdata is a ifstream object of mode type binary.
ifstream validdata;
fstream sortfile;
how would I read a union.
union Allrecords *rec;
That's not a union, its a pointer to a union.
Assuming you have made rec point to a suitable piece of memory (I remember
you making this mistake before) then
validdate.read(rec, sizeof *rec);
will read a single record into the union pointed to by rec.
Write? I though you were trying to read (that also was something you were
confused about earlier).
how would i write this to the sortfile, sortfile is a text file (.txt).
There is no simple way to write a union to a text file. It all depends on
exactly what you want to write. You have to decide how you want to write it
and use << appropriately. For more advice post the definition of Allrecords
and say precisely how you want the data to appear, i.e. what is to be
written under what circumstances, where spacing is needed, where newlines
are needed etc. etc.
john