ReadBinFile

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All

Syntax

ReadBinFile (pathnamebinfld [, start [, length]] ) Returns return-value

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

ReadBinFile reads binary data from the file system or data fork (not the resource fork).

Note for macOS Users: ReadBinFile and WriteBinFile are only useful for reading and writing the data fork of files.

Pathname is a character field containing the full path of the file to read.

Binfld is a binary field in which the data is stored.

Start is an optional parameter specifying an integer field that contains the byte position in the file where the command should start reading. Defaults to 0 (zero), that is, the beginning of the file.

Length is an optional parameter specifying an integer field containing the number of bytes to read. If the parameter is not used, the value defaults to the length of the file.

Return-value is a long Integer that is the number of bytes read, if no error occurs. Otherwise, it is an error code, one of:

Code
-1
-2
-10
-11
-12
-20
-100
-101
-998

Example

# read the binary data from the file lPathname
Calculate lPathname as con(sys(115),'binfile')
ReadBinFile (lPathname,lBinfldReturns lNumbytes
OK message {[lNumbytes] bytes read}