writing a structure to a file

I don't really a program that exists yet, but i was thinking of writing code that would allow the user to enter a structure into a file that already contains a handful of structures. The structure entered should be placed in alphabetical order with the already existant structures in the file. I am not gonna ask you guys to write the code for me, just a general outline would help. Do you think the seekg and seekp functions might come handy in the program? I don't really have an organised plan how to approach this problem.
A few things to thing about:
The seek functions will be handy.

Are the structures the same size? If not, you will need a mechanism to let you know when you've finished reading a particular structure.

You probably want to use the first field in each structure as what you will be sorting.

You will probably need to rewrite the file when adding a new structure -- this will help you in sorting.

I hope this helps!

Topic archived. No new replies allowed.