ALLOCATE(<N bytes>)
Provides memory storage for data accessible by address instead of name.
Returns <expC> 8-byte hexadecimal address of segment and offset.
In Summer '87, memory is allocated downward from the highest
available address, leaving space between it and Clipper for Clipper
to use. In 5.0, memory is allocated from Clipper's fixed stack.
The amount of memory allocated becomes reserved and cannot be used
by Clipper or any other software until you release it with DEALLOC().
Release all the memory you allocated before terminating your program.
Use the SUBSTR() function to break up segment and offset return value:
m_buffer = ALLOCATE(1000)
m_seg = SUBSTR(m_buffer, 1, 4)
m_off = SUBSTR(m_buffer, 5, 4)
Returns a null character if memory cannot be allocated.
m_buffer = ALLOCATE( 1024 )
m_seg = SUBSTR(m_buffer, 1, 4)
m_off = DEC(SUBSTR(m_buffer, 5, 4)) && convert hex to decimal
IF "" = m_buffer && null means an error
<error message>
RETURN && cancel this routine
ENDIF
* Store 11 integers from 0 to 10.
FOR i = 0 TO 10
IF ! POKEINT(m_seg, m_off+(i*2), i)
ENDIF
NEXT
* Do whatever with the stored information.
FOR i = 0 TO 10
array[i+1] = PEEKINT(m_seg, m_off+(i*2))
NEXT
* Clean up before leaving the application.
DEALLOC(m_buffer, 1024)
Hazard
Do not alter or destroy the memory variable containing
the address (m_buffer in above example) until after
you have released the memory.
Placed in the Public Domain by Tom Rettig Assoc.