LockStringSize - Get the size (number of bytes) of a string locked in memory

Top  Previous  Next

Syntax

 

<nLen> := LockStringSize( <nAddress> )

 

Parameters

 

<nAddress>

 

Address of allocated memory block that was returned by LockString or LockNullString.

 

Return value

 

Size of string (number of allocated bytes) locked in memory at address <nAddress>.  If <nAddress> is not of numeric type, 0 is returned.

 

Description

 

LockStringSize returns the size of the string (number of bytes) that was written to memory using LockString or LockNullString. The string size will differ from the length for Unicode text strings. Use LockStringLen to retrieve the string length (=number of characters).

 

Classification

 

Core

 

Category

 

Pointers and Memory

 

Quick Info

 

Library: cckptcor.lib / cckptcor.dll

 

See also

 

LockString, LockNullString, LockStringLen

 

Example

 

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "StringTypes.ch"

 

FUNCTION Main

 

LOCAL address

 

* Allocate memory and fill it with "Here"

address := LockString( "Here", STRINGTYPE_UNICODETEXT )

 

* Read the string size, 8 should be the result

? LockStringSize( address )

 

* Release the allocated memory

ReleaseLockString( address )

 

RETURN NIL