TutBufAppendBuf


Name

TutBufAppendBuf — append the contents of one buffer into another

Synopsis

T_PTR TutBufAppendBuf(dest, src, size) 
T_BUF dest; 
T_BUF src; 
T_INT4 size; 

Arguments

dest — T_BUF object to receive the data

src — T_BUF object to provide the data

size — number of bytes to copy

Return Values

Pointer into the destination buffer where the data was copied if successful, NULL otherwise.

Diagnostics

None

Description

TutBufAppend copies data from the source buffer starting at that buffer’s "read pointer" into the destination buffer, appending the data onto the end of the destination buffer. The destination buffer grows, if necessary, to accommodate the data. If the given size is -1, then all of the data in the source buffer from the current location to the end of the buffer is copied. If the given size is past the end of the source buffer, this function fails.

Caution

The returned pointer is only valid until the next call to a buffer operation that may resize the buffer, because the buffer may be moved during a resize.

See Also

TutBufCreate, TutBufDestroy, TutBufAppendRange

Examples

This example copies eight bytes from the buffer src to the buffer dest:

T_PTR ptr; 
ptr = TutBufAppendBuf(dest, src, 8); 
if (ptr == NULL) { 
   /* error */ 
} 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com