>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

bigfiles: big file utilities

Use Windows API for common file access verbs. These handle files (and drives) with sizes greater than 2^31 bytes.

They represent 64 bit integers as 2 element integer vectors.

Indexed read and write have an optional flag indicating the use of the index. If the flag is non-negative, the index is from the start of the file. If the flag is negative, the index is from the end of the file.

f can be either a text file name or a file handle (from bopen).

    bytes written=.data bappend f                           append to end
    data=.bixread f;start0,start1[,len[,dirflag]]           indexed read
    bytes written=.data bixwrite f;start0,start1[,dirflag]  indexed write
    free space=.bdiskfreespaceex dir                        get disk free space
    free space=.bdiskfreespace drive root                   get disk free space (device units)
    size=.bfsize f                                          get file size
    fh=.[mode] bopen filename                               open file input or inout
    success=.bclose fh                                      close open file
    sys_drives=.getdrives ''                                return vector of windows drive letters
    sys_drive_free_space=.getdrivespace ''                  return matrix of drive letters
    are_same=.f1 bfcomp f2                                  compare 2 files
Contributed by David Mitchell in J Forum posting April 2003.

Name Type Description
bappend verb append to end
bclose verb close open file handle
bdiskfreespace verb return disk free space
bdiskfreespaceex verb return extended disk free space
bfcomp verb compare 2 big files
bfsize verb return size of file
bixread verb indexed read
bixwrite verb indexed write
bopen verb open file read or readwrite
getdrives verb get system drive letters
getdrivespace verb get system drive letters and free space


append to end
form: data bappend f


close open file handle
form: bclose fh
returns 1 if successful, 0 if not


return disk free space
form: bdiskfreespace drive root (must be similar to 'c:\')
returns 4 elements: SectorsPerCluster,BytesPerSector,NumberOfFreeClusters,TotalNumberOfClusters


return extended disk free space
form: [flag] bdiskfreespaceex dir
if flag=0 returns 3x2 matrix of integers, representing 3 64 bit values.
if flag=1 returns 3 element vector of floats, representing 64 bit values.
See MS SDK for more information.


compare 2 big files
form: f1 bfcomp f2
returns 0 if different 1 if same


return size of file
form: bfsize f
returns 2 integer vector


indexed read
form: bixread f;start0,start1[,len[,dirflag]]


indexed write
form: data bixwrite f;start0,start1[,dirflag]
returns bytes written


open file read or readwrite
form: [mode] bopen filename
returns file handle
mode is 0 for read, 1 for readwrite, default read


get system drive letters
form: getdrives ''
returns drive letter vector if successful, error if not


get system drive letters and free space
form: getdrivespace ''
returns nx2 drive letter, space available if successful, '' if not

>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User