TutBufAppendRange


Name

TutBufAppendRange — append the contents of a range of one buffer into another

Synopsis

T_PTR TutBufAppendRange(dest, src, begin, end) 
T_BUF dest; 
T_BUF src; 
T_INT4 begin; 
T_INT4 end; 

Arguments

dest — T_BUF object to receive the data

src — T_BUF object to provide the data

begin — start of the block to copy

end — end of the block to copy

Return Values

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

Diagnostics

None

Description

TutBufAppendRange copies a block of data end - begin bytes long from the source buffer starting at begin 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 end is -1, then all of the data in the source buffer from begin to the end of the buffer is copied. If begin or end are outside of the range 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, TutBufAppendBuf

Examples

This example copies 8 bytes from the buffer src starting at byte 3 to the buffer dest:

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

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