[vox-tech] [C] randomly accessing file data in C
Ken Herron
vox-tech@lists.lugod.org
Tue, 20 May 2003 19:10:43 -0700
--On Tuesday, May 20, 2003 06:45:53 PM -0700 "Mark K. Kim"
<markslist@cbreak.org> wrote:
> Hello...
>
> I'm trying to access data in a file in C. I want to read some portion
> of it, modify it, then rewrite that portion back into the file.
>
> Reading isn't a problem -- I can use fseek or lseek or whatever and read
> the data I want using fread or read. No problem.
>
> Writing is another matter. When I seek to the spot and write the
> modified data, it destroys the data that comes afterwards.
That's not the way it's supposed to work. Could you post the code you're
using to open this file and write to it?
--
Ken Herron