Description
Concatenates a CTBUFF instance to another CTBUFF instance. A CTBUFF instance may concatenate to itself.
Prototype
DCTBUFF_BuffCat...
D PR 10I 0
D@This * Value
D@Buff * Value
Parameters
@This
Type | Pointer (*) |
Passing Mode | Value |
Description | The address of an CTBUFF instance. This pointer MUST be obtained through a call to CTBUFF_Constructor. |
@Buff
Type | Pointer (*) |
Passing Mode | Value |
Description | The address of an CTBUFF instance. This pointer MUST be obtained through a call to CTBUFF_Constructor. |
Return Values
Returns the number of bytes of the CTBUFF instance resulting from the concatenation.
Examples
HDatEdit(*YMD)
*--------------------------------------------------------------
* Clara-Tools Definitions
*--------------------------------------------------------------
/Include QINCSRC,CTBASE
DEntryProc Pr ExtProc('TESTBUFF')
DEntryProc PI
*-------------------------------------------------------------------------------
* Main
*-------------------------------------------------------------------------------
DpBuff S *
DpBuff2 S *
DBuffer S 512A
DBytes S 10I 0
/Free
// Create 2 CTBUFF instances
pBuff = CTBUFF_Constructor();
pBuff2 = CTBUFF_Constructor();
// Set buffer of 1st CTBUFF instance
Buffer = 'Hello ';
// Size of 6 to keep the blank
CTBUFF_Set(pBuff: %Addr(Buffer): 6);
// Set buffer of 2nd CTBUFF instance
Buffer = 'World';
CTBUFF_Set(pBuff2: %Addr(Buffer): %Len(%Trim(Buffer)));
// Concatenate 2nd buffer to 1st buffer
CTBUFF_BuffCat(pBuff: pBuff2);
// Check the result ...
// On return, the Bytes value is 11.
Bytes = 512;
Clear Buffer;
CTBUFF_Get(pBuff: %Addr(Buffer): 1: Bytes);
// We will now concatenate a CTBUFF with itself:
CTBUFF_BuffCat(pBuff: pBuff);
// Check the result ...
// On return, the Bytes value is 22.
Bytes = 512;
Clear Buffer;
CTBUFF_Get(pBuff: %Addr(Buffer): 1: Bytes);
// Release CTBUFF instances
CTBUFF_Destructor(pBuff);
CTBUFF_Destructor(pBuff2);
*InLr = *On;
/End-Free
Result of first concatenation:
Previous debug expressions
421 ' '
481 ' '
> EVAL Buffer
BUFFER =
....5...10...15...20...25...30...35...40...45...50...55...60
1 'Hello World '
61 ' '
121 ' '
181 ' '
241 ' '
301 ' '
361 ' '
421 ' '
481 ' '
Result of second concatenation:
421 ' '
481 ' '
> EVAL Buffer
BUFFER =
....5...10...15...20...25...30...35...40...45...50...55...60
1 'Hello WorldHello World '
61 ' '
121 ' '
181 ' '
241 ' '
301 ' '
361 ' '
421 ' '
481 ' '