Consultor Eletrônico



Kbase P16392: How to read a binary file using the BINARY option of the INPUT FROM statement.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   31/12/2008
Status: Verified

GOAL:

How to read a binary file

GOAL:

How to read data from a binary file

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

FIX:

To read a binary file, the BINARY option of the INPUT FROM statement must be used.
The following example procedure reads a binary file into a MEMPTR variable:

PROCEDURE loadFile2Memptr:
DEFINE INPUT PARAMETER ipc_fileName AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER opm_message AS MEMPTR NO-UNDO.
FILE-INFO:FILE-NAME = ipc_fileName.
SET-SIZE(opm_message) = FILE-INFO:FILE-SIZE.
INPUT FROM VALUE(ipc_fileName) BINARY NO-MAP NO-CONVERT.
IMPORT UNFORMATTED opm_message.
INPUT CLOSE.