Subject: lseek() quick question
To: None <netbsd-help@NetBSD.ORG>
From: None <tooleym@douglas.bc.ca>
List: netbsd-help
Date: 02/03/1998 14:00:47
I've been writing a short little program to alter the contents of a data
file based on pattern matching--similar to diff only infinitely more crude
(grovel grovel)--I read in the structure, compare a field or three with
the pattern I'm looking for, and if it matches, then I change another of
the fields, and then rewrite it back into the same place.

lseek(datafile, -(sizeof(struct dataentry)), SEEK_CUR);

This is my problem. The negative value apparently isn't allowed? I want to
back up to the beginning of the section of data, then execute a write()
call.

I find that re-writing the field turns my file into a giant 4 GB sparse
file when re-writing the first field..  doh!

Any help would be appreciated,

Sincerely,

Marc Tooley