LockStringArray - Lock an array of string data to memory

Top  Previous  Next



<nAddress> := LockStringArray( <aStringData>, [<nType] )






An array (list) containing strings to be committed to memory.




Type of string data to be written to memory. This value can be STRINGTYPE_BINARY, STRINGTYPE_BINARY0, STRINGTYPE_TEXT, STRINGTYPE_UNICODETEXT. Specifying this parameter requests character set conversions while copying the string data. Default is STRINGTYPE_BINARY. Checking the type of the written array data with LockStringType will always return STRINGTYPE_BINARY.


Return value


The memory address where the array starts.




LockStringArray allocates a memory block for <aStringData> and writes the string array contained in <aStringData> to that block. Necessary character set conversions are applied while the data is being moved if a string type other than STRINGTYPE_BINARY and STRINGTYPE_BINARY0 was specified for <nType>. The strings are separated in memory by one 0-byte (two 0-bytes for Unicode strings) and the array is terminated by another 0-byte (two 0-bytes for Unicode strings) at the end. The memory allocated by LockStringArray must later on be explicitly released with ReleaseLockString. The string type recorded is always STRINGTYPE_BINARY. To read the data committed to memory use CopyMemoryToStringArray.








Pointers and Memory


Quick Info        


Library: cckptcor.lib / cckptcor.dll

Header: StringTypes.ch


See also


ReleaseLockString, CopyMemoryToStringArray





#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "StringTypes.ch"




LOCAL address


* Lock a Unicode string array to memory

address := LockStringArray( {"Here","we","go"}, STRINGTYPE_UNICODETEXT )


* Show the data byte by byte in hex form

? "Data bytes: ",HexString( CopyMemoryToString( address,, LockStringSize(address) ) )


* Read the data back into an array

? "Data: ", CopyMemoryToStringArray( address, STRINGTYPE_UNICODETEXT )


* Free the allocated memory

ReleaseLockString( address )