TutBufCreateStatic


Name

TutBufCreateStatic — wrap a buffer around an existing block of data

Synopsis

T_BUF TutBufCreateStatic(ptr, size) 
T_PTR ptr; 
T_INT4 size; 

Arguments

ptr — pointer to the existing block of data

size — size of the new buffer, in bytes

Return Values

A new T_BUF object if successful, NULL otherwise.

Diagnostics

None

Description

TutBufCreateStatic creates a new buffer using an existing block of data. This data is not copied, but used in place, so alterations to this buffer alter the original data. Static buffers do not grow to accommodate new data. When the buffer is destroyed with TutBufDestroy, the actual data is not deallocated, only the T_BUF object itself.

Caution

None

See Also

TutBufDestroy, TutBufCreate

Examples

This example creates a static buffer from a block of data:

T_PTR ptr; 
 
ptr = T_CALLOC(128); 
buf = TutBufCreateStatic(ptr, 128); 
if (buf == NULL) { 
  /* error */ 
} 
else { 
  /* ptr may be used directly here, say to a file */ 
} 

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