but the program is not working properly.
in my original class there are more than 15 data members. And what i want to do is if the user presses enter in a particular field the record for that field which was present before remains as it is i.e. that field is not modified. But the function works properly for only the first few data members and not for the last ones.The last data members when displayed appear blank or garbage data is displayed. Please help me out.

Modification of a file would be better achieved by creating a temporary buffer with all the changes then overwrite the original file.

Another alternative is to simply write each record to a new file. When done, the program can delete the original file and rename the new file. This will also save all the file pointer stuff you're doing now, making the code much simpler and safer.

Another alternative is to simply write each record to a new file. When done, the program can delete the original file and rename the new file. This will also save all the file pointer stuff you're doing now, making the code much simpler and safer.

as told by you i used the following code but if the record to be modified is the last record it works fine, but if its the record somewhere in between then the rest of the records i.e. the records after that record are deleted.

Sounds like you still have a problem -- and I'll bet gets() has something to do with it. You are probably overrunning an array somewhere. Like entering 10 or more characters into a character array defined as 10...