System information

FUNCTION 35: COMPUTE FILE SIZE
Entry Parameters:
Register C: 23H
Registers DE: FCB Address
Returned Value:
Random Record Field Set
When computing the size of a file, the DE register pair addresses an FCB in random mode format
(bytes r0, r1, and r2 are present). The FCB contains an unambiguous filename that is used in the
directory scan. Upon return, the random record bytes contain the virtual file size, which is, in
effect, the record address of the record following the end of the file. Following a call to Function
35, if the high record byte r2 is 01, the file contains the maximum record count 65536.
Otherwise, bytes r0 and r1 constitute a 16-bit value as before (r0 is the least significant byte),
which is the file size.
Data can be appended to the end of an existing file by simply calling Function 35 to set the
random record position to the end-of-file and then performing a sequence of random writes
starting at the preset record address.
The virtual size of a file corresponds to the physical size when the file is written sequentially. If
the file was created in random mode and holes exist in the allocation, the file might contain fewer
records than the size indicates. For example, if only the last record of an 8-megabyte file is
written in random mode (that is, record number 65535), the virtual size is 65536 records,
although only one block of data is actually allocated.
5.2 Call Conventions CP/M Operating System Manual
5-33