I usually make a copy of the file, some of the modes create a new file =
that overwrites the stored file, copy the contents to the new file.
Don't forget, once you've read a record from the file that the file =
pointer has moved to the end of the record, so move it back one record =
to overwrite it, something like:
fseek(stream, (-1 * SIZE_OF_RECORD), SEEK_CUR)
If the stream is not a pointer use the address of character '&'.
The -1 means "go backwards once".
SEEK_CUR means from current position.
----- Original Message -----=20
From: Sam=20
To: dev...@li...=20
Sent: Monday, March 12, 2001 1:22 AM
Subject: [Dev-C++] random access file updating
hello all,
I have an assignment due for a class in C programming. we are working =
on random access files. I have been able to write the code to add =
records and search the file, but I'm having trouble with updating the =
file. Any hits on how to write over a record in a random access file?? =
|