LockStringType - Get the type of a string locked in memory

Top  Previous  Next

Syntax

 

<nLen> := LockStringType( <nAddress> )

 

Parameters

 

<nAddress>

 

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

 

Return value

 

Type of string locked in memory at address <nAddress>. Valid types are: STRINGTYPE_BINARY, STRINGTYPE_BINARY0, STRINGTYPE_TEXT and STRINGTYPE_UNICODETEXT.

 

Description

 

LockStringType returns the type of a string that was locked to memory using LockString or LockNullString.

 

Classification

 

Core

 

Category

 

Pointers and Memory

 

Quick Info

 

Library: cckptcor.lib / cckptcor.dll

Header: StringTypes.ch

 

See also

 

LockString, LockNullString

 

Example

 

 

#INCLUDE "CockpitCoreLibs.ch"

#INCLUDE "StringTypes.ch"

 

FUNCTION Main

 

LOCAL address,sType

 

* Allocate memory and fill it with "Here"

address := LockString("Here we go.",STRINGTYPE_UNICODETEXT)

 

* Get the string type and display it

sType := LockStringType(address)

 

DO CASE

 

  CASE sType == STRINGTYPE_UNICODETEXT

       ? "Unicode text."

 

  CASE sType == STRINGTYPE_TEXT

       ? "Ansi text."

 

  CASE sType == STRINGTYPE_BINARY

       ? "Binary data."

 

  CASE sType == STRINGTYPE_BINARY0

       ? "Binary 0-terminated data."

 

ENDCASE

 

* Release the allocated memory

ReleaseLockString( address )

 

RETURN NIL