Read entire file

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

Syntax

Read entire file (pathbinary-variable [,'r']) Returns err-code

Description

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

This command reads an entire file into a binary field. If you specify 'r' as the third parameter, it opens the file in read-only mode. It returns an error code, or zero if no error occurs. The returned binary value has the following format:

The Type is always ‘TEXT’, and the Creator is always ‘mdos’.

Example

; Prompt the user for a file and read it's entire contents into the
; binary variable lBinFld
Do FileOps.$putfilename(lPathname,'Select a file','') Returns lReturnFlag
If lReturnFlag
  Read entire file (lPathname,lBinfld) Returns lErrCode
End If