[comp.lang.c] Low-level random-access I/O pkg sought

ddh@hare.cdc.com (Dan Horsfall) (03/20/91)

I have what would be a straightforward requirement, but for two
"minor obstacles" that may force me to toss out an entire design and
start over.  Hopefully, the wisdom that comes only from experience
can help me out here!

I need an I/O package for a Un*x variant OS, which implies but does
NOT require language C.  For basic functionality, it needs only to be
able to read and write arbitrary byte-streams to or from arbitrary byte
addresses/offsets in a file.  Supporting code (open and close) merely
builds on top of that stuff, in my mind.

Reading an existing file is trivial with stdio: seek to address, move
bytes.  Except for BA+LEN<EOF, there's not even error checking :-)!

Writing poses some hurdles:
1) I'm told that stdio assumes EOF always follows the last byte written;
   thus rewriting a block into the middle of an existing file will likely
   trash the rest of it.
2) Writing to an offset beyond the previous EOF requires that "something" 
   be done in the intervening gap.  It _is_ legal to write to
   byte address 1,000,000 as the first operation on such a file.

An ISAM package is overkill for this application.

Any suggestions??  Anyone seen this done, in a piratable fashion??  Anybody
actually got any source code they'd like to share, thus earning my 
undying gratitude for a finite period of time??

-- 
   Horse
                                       +    Control Data Corporation      
   Dan Horsfall     +1-612-482-4622    +    4201 Lexington Ave North      
   Internet   ddh@dash.udev.cdc.com    +    Arden Hills MN 55126 USA