(v13) bytes_file return bytes available for an open file


This page applies to Harlequin v13.1r0 and later; and to Harlequin Core but not Harlequin MultiRIP


  int32 bytes_file (
  DEVICELIST *dev,
  DEVICE_FILEDESCRIPTOR descriptor, Hq32x2 *bytes,
  int32 reason );

This routine returns in bytes the number of bytes available for reading without waiting. See the bytesavailable operator, described in [RB3].

If the number of bytes available is not known, but it is possible that there are some, 0 should be returned in bytes and TRUE should be returned. If the file has reached EOF or when some other error occurs, such as when the file is open for writing only, FALSE should be returned and last_error s hould return DeviceIOError .

The value of reason is one of:

                      SW_BYTES_AVAIL_REL (0)
                      SW_BYTES_TOTAL_ABS (1)

… where SW_BYTES_AVAIL_REL will give the answer as bytes immediately available after the current position, and SW_BYTES_TOTAL_ABS gives the total extent of the file in bytes.

Note that the %config% device makes a rather more specific interpretation of the result of this call. See (v13) Configuration device routines for details.