ReleaseString

PowerBuilder Native Interface

IPB_Session interface:

ReleaseString method

Description

Frees the memory acquired using GetString, GetClassName, GetFieldName, or GetEnumItemName.

Syntax

ReleaseString(LPCTSTR string)

Argument

Description

string

The string to be released from memory

Return Values

None.

Examples

The following example gets a pointer to each of two strings passed in as arguments, concatenates them in a new string, then releases the memory used by the original strings:

pbstring psppcls:: f_add_string(IPB_Session* session, pbstring arg1, pbstring arg2)
{
   LPCTSTR pStr1,pStr2;
   TCHAR tmp[100];
   pbstring ret;

   pStr1=session-> GetString(arg1);
   pStr2=session-> GetString(arg2);
   _tcscpy(tmp,pStr1);
   _tcscat(tmp,pStr2);
   ret = session -> NewString(tmp);
   session-> ReleaseString(pStr1);
   session-> ReleaseString(pStr2);

   return ret ;

}

Usage

Do not use this function to release a string obtained using GetDateString, GetTimeString, GetDateTimeString, or GetDecimalString. Each of these Get methods has a corresponding Release method.

See Also