Closing a binary file before it ends
i'm working on a school project (a phonebook) using a binary file.
one of the procedure's is to delete a person from the phonebook file. i've been working on an idea for this and in short it has to do with taking the last person in the file and copying him over the person to be deleted and then closing the file just before the last person(thus making the file smaller)
the only problem is i cant close the file not at the end. i position my file pointer just before the last person in the file( using fseek(phonefile,-sizeof(node),SEEK_END) ) and then i do fclose(phonefile) to close the file just before him. but when i check the file he is still there!
meaning that an EOF was not assigned to the place i wanted but rather to the end of the file.