CopyMemoryToStringArrayIndexed - Transfer indexed data from memory to a string array

Top  Previous  Next

Syntax

<aStrings> := CopyMemoryToStringArrayIndexed( <nAddress>, [<nType>], [<nMaxElementCount>], [<nElementLen>] )

Parameters

<nAddress>

 

Start address of string address array in memory.

 

<nType>

 

Type of string data to be read from memory. This parameter determines character set conversion and string termination. See Cockpit string types for details. The default is STRINGTYPE_BINARY

 

<nMaxElementCount>

 

Maximum number of elements in the returned array. If this parameter is not specified, all elements in the indexed array found in memory are read. The string address array at <nAddress> must in this case be terminated with a  0 address.

 

<nElementLen>

 

Length (number of characters) of the elements. If this parameter is not specified, the lengths of the strings are automatically determined according to <nType>.

Return value

An array containing the strings found in memory at the addresses referenced by an address array at <nAddress>.

Description

An address array starting in memory at <nAddress> is scanned and the strings found at the addresses in the array are returned as an Xbase++ array of strings. The addresses are 4 bytes wide (each) and the address array must be terminated by a 0 address if no <nMaxElementCount> value is passed. During the transfer from memory to the returned string array conversions can be requested with <nType>. Refer to Cockpit string types for details.

 

If you need to limit the number of strings to be read from memory, you can pass a maximum number in <nMaxElementCount>.

 

The length of every string (number of characters) can be set to a fixed value with <nElementLen>. This will deactivate the automatic string length determination through <nType>.

Classification

Core

Category

Pointers and memory

Quick Info

Library: cckptcor.lib / cckptcor.dll

Header: StringTypes.ch

See also

CopyMemoryToStringArray, LockStringArrayIndexed

Example

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "StringTypes.ch"

 

FUNCTION Main

 

LOCAL address

 

* Put an indexed string array in memory

address := LockStringArrayIndexed( {"Here","we","go","again"} )

 

* Read the indexed string array

? CopyMemoryToStringArrayIndexed( address )

 

* Release the allocated memory

ReleaseLockString( address )

 

RETURN NIL