Input and output

<< Click to Display Table of Contents >>

Navigation:  Using SMILE >

Input and output

SMILE supports two types of network I/O:

string-based, with DSL_network::WriteString and ReadString

file-based, with DSL_network::WriteFile and ReadFile

The native format for SMILE networks is XDSL. The format is XML-based and the definition schema is available at BayesFusion documentation website (http://support.bayesfusion.com/docs/). When writing a network in this format to file, the .xdsl extension should be used.

XDSL is the only format supported by string I/O methods. File-based methods can read and write other formats. Depending on the feature parity between SMILE and the 3rd party software using other file types, some of the information may be lost. For complete list of supported file types, see the reference section for DSL_network::ReadFile.

By default, the file I/O methods infer the file format from the filename extension (the format can be also explicitly specified in the call).

DSL_errorH().RedirectToFile(stdout);

DSL_network net;

int res = net.ReadFile("my_network.xdsl");

if (DSL_OKAY != res)

{

    printf("ReadFile failed.\n");

}

In case of a read failure, the above program will send a specific error message to standard output (due to the earlier RedirectToFile(stdout) call).