I have been trying to write code for reading and writing a file. I am facing a problem with that. I am using fread and fwrite functions for it. I am writing data through structures in a file. I want to make a simple telephone directory to which I can enter data, search a contact and list the contacts in alphabetical order.
First of all I am writing records with fwrite function. Then I read it through fread function. What happens in this, when I open the file for reading purpose only, it repeats the last record twice in print or it shows junk values when I have given the contion to read upto EOF.
Any good technique to handle file so I can enter data any time, read it, search it and sort the records. Please reply..msaqib39099.2203935185