Page 1 of 1

Generic random fcntl library

Posted: Tue Jan 14, 2014 7:08 am
by stefano
'gendos' is a random file access extension for those computers having primitive memory block load/save functions.
Only two functions must be provided to interface the native block load/save routines by a given filename.
The trick is to add an extra character (0..Z) to the filename to create virtual file blocks; the block size is set to 1K by default but it can be different on every single 'random access file'.
The underscore character is used to create a "control file" keeping the file properties: its size, the size to be set for a single block, etc..
(file splitting/merging tools will be provided)

At the moment I tested this library with S-OS:

Code: Select all

>zcc +sos -create-app -lgendos -lmalloc -DAMALLOC wc.c

Loading a            .obj

wc - Count the number of bytes, words,
and lines in one or more files.
#J3000 >file
#J3000 file

Lines   Words   Bytes    File
------- ------- -------  -----------
0000003 0000015 0000072  file
Bin  Q:a            .obj:3000:4A7E:3000
Bin  Q:_file        .   :D24E:D26D:2100
Bin  Q:0file        .   :CE63:D24A:2100