|NORSYS SOFTWARE © 2012||NETICA API||C   VERSION   5.04 |
|stream_ns* NewMemoryStream_ns (||const char* name, environ_ns* env, const char* access )|
Returns a Norsys stream for reading and writing to buffers in memory, in the same format reading/writing is done to disk files.
name is a symbolic name for identifying the stream (e.g., in error messages), and providing information on the expected format of the buffer, in the same way that a file extension can be used to indicate the format of disk files.
name is not necessarily the name of a file on the OS filesystem. If the end of name consists of a dot and then a few characters, it will be interpreted like a filetype extension, which can be useful to Netica in deciding the data format of the stream. For example, writing a net to a memory stream with a ".dnet" or ".dne" extension will result in a text file Netica format ("DNET format"), whereas using a ".neta" extension would result in a binary Netica file.
Netica will make a copy of filename; it won't modify or free the passed string.
Pass NULL for access; it is only for future expansion.
When done with the stream_ns produced, call DeleteStream_ns.
|SetStreamContents_ns||Sets memory buffer|
|GetStreamContents_ns||Retrieves memory buffer|
|SetStreamPassword_ns||Prepare the stream to do encryption or decryption|
|DeleteStream_ns||Releases all resources (e.g., memory) used by this stream|
long length; stream_ns* strm = NewMemoryStream_ns ("myBuf.dne", env, NULL); WriteNet_bn (net, strm); // write a net into the memory buffer const char* buf = GetStreamContents_ns (strm,Example 2:
length); // ... [examine and use the buffer contents] ... DeleteStream_ns (strm);
stream_ns* strm = NewMemoryStream_ns ("myBuf.cas", env, NULL); const char* casedata = "A B C \n yes no 1 \n yes yes 3 \n no no 1"; SetStreamContents_ns (strm, casedata, strlen (casedata), true); ReviseCPTsByCaseFile_bn (strm, nodes, 0, 1.0); DeleteStream_ns (strm);