TutBufCreateStatic wrap a buffer around an existing block of data
ptr
pointer to the existing block of data
size
size of the new buffer, in bytes
A new T_BUF object if successful, NULL
otherwise.
None
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.
None
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 |