void SetStreamContents_ns ( stream_ns*  strm,   const char*  buffer,   long  length,   bool_ns*  copy )

Sets strm's memory buffer to be buffer, so that future reading from strm will take place from buffer.

strm must be a memory stream (created by a call to NewMemoryStream_ns) or an error will be generated.

buffer is a pointer (possibly NULL) to the new memory buffer. If you wish Netica to later interpret the contents of this buffer as an ascii string (e.g., if the buffer contains case data that will be parsed into a Caseset), then this buffer must be null terminated. Once passed into this function, buffer should not be freed or modified until either DeleteStream_ns is called on strm, or a new buffer is assigned to strm with this function (possibly NULL to empty it). Netica will not free or modify buffer, even when DeleteStream_ns is called.

length is the number of bytes in buffer, excluding any terminating null.

Normally you will pass TRUE for copy, so that Netica copies the string in buffer for its own use. However, if the string is very large, for efficiency you can pass FALSE, in which case you must ensure that the contents of buffer are not modified or deallocated until the stream_ns is destroyed or has its contents set to something else.

Version:

Versions 2.26 and later have this function. In versions previous to 3.05, this function was named SetStreamBuffer_ns.

See also:

NewMemoryStream_ns    Create new memory stream
GetStreamContents_ns    Retrieves buffer

Example:

See NewMemoryStream_ns.
Example 2:
See SetStreamPassword_ns.