Dennis Schulz <> wrote:
> i am iterating through the whole file looking for besitzer.
> When there is a match, i want the current record to be modified (add
> zuschlag) and saved again at the same position in the file.
> Here is the problem:
> the fwrite in my coding overwrites the next data record
> instead of replacing the current one. How can I jump one record back?
> Do I have remember the index and iterate from the beginning again, or
> is there a more elegant method?
Yes, there's the fseek() function. Call it with the file pointer
as the first, the number of bytes you want to skip back (in this
case that's a negative number, use a positive one to skip forward)
as the second and SEEK_CUR as the third argument.
Regards, Jens
--
\ Jens Thoms Toerring ___
\__________________________
http://www.toerring.de