PUT-BYTE statement
Stores the unsigned 1-byte value of an integer expression at the specified memory location.
Syntax
destination
A variable of type RAW or MEMPTR. Ifdestination
is the Unknown value (?
), it remains the Unknown value (?
). Ifdestination
is a MEMPTR and has not had its region allocated (by a SET-SIZE statement or by a Windows dynamic link library (DLL) or UNIX shared library routine), the AVM generates a run-time error.position
An integer value greater than 0 that indicates the byte position where the AVM storesexpression
. Ifposition
is less than 1, the AVM generates a run-time error. For a RAWdestination
, ifposition
is greater than the length ofdestination
, the AVM changes the length ofdestination
toposition
and pads the gap with null bytes. For a MEMPTRdestination
, ifposition
is greater than the length ofdestination
, the AVM generates a run-time error.expression
ExamplesThis procedure finds the name of Customer 26, Jack’s Jacks, and stores it in the RAW variable r1. The PUT-BYTE statement replaces the first four bytes in the
Name
with the specified character code values. The procedure then writes the values in r1 back into theName
field and displays that field. Jack’s Jacks becomes Bill’s Jacks.
The following example allocates a MEMPTR region large enough to hold the character string “Bill”, terminated by a null byte. It stores the string one byte at a time using the PUT-BYTE statement, and then displays the string directly from the region.
NoteFor more information on accessing DLL routines from ABL, see OpenEdge Development: Programming Interfaces.
See alsoGET-BYTE function, LENGTH function, LENGTH statement, RAW function, RAW statement, SET-SIZE statement
OpenEdge Release 10.2B
|