Low-level random-access I/O pkg sought

Dan Horsfall ddh at hare.cdc.com
Wed Mar 20 02:08:31 AEST 1991


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 at dash.udev.cdc.com    +    Arden Hills MN 55126 USA      



More information about the Comp.lang.c mailing list