Consultor Eletrônico



Kbase P39210: How to read/write files into/from memptr variables?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/14/2007
Status: Verified

GOAL:

How to read/write files into/from memptr variables?

GOAL:

How to read a file into a memptr?

GOAL:

How to write a memptr to a file?

FIX:

To read a file into a memptr:


/* make sure memptr is sized correctly */

FILE-INFO:FILE-NAME = "SomeFileNameGoesHere".
SET-SIZE(SomeMemoryPointerGoesHere) = FILE-INFO:FILE-SIZE.

/* the actual read */

INPUT FROM "SomeFileNameGoesHere" BINARY NO-CONVERT.
IMPORT SomeMemoryPointerGoesHere.
INPUT CLOSE.

To write a memptr out to a file:


OUTPUT TO "SomeFileNameGoesHere".
EXPORT SomeMemoryPointerGoesHere.
OUTPUT CLOSE.