Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
SetStreamFunctionWrite Method (streamType, function)
SwiPlCs interface ► SbsSW.SwiPlCs ► PlEngine ► SetStreamFunctionWrite(PlStreamType, DelegateStreamWriteFunction)
This is a primitive approach to enter the output from a stream.
Declaration Syntax
C# | Visual Basic | Visual C++ | F# |
public static void SetStreamFunctionWrite( PlStreamType streamType, DelegateStreamWriteFunction function )
Public Shared Sub SetStreamFunctionWrite ( streamType As PlStreamType, function As DelegateStreamWriteFunction )
public: static void SetStreamFunctionWrite( PlStreamType streamType, DelegateStreamWriteFunction^ function )
static member SetStreamFunctionWrite : streamType : PlStreamType * function : DelegateStreamWriteFunction -> unit
Parameters
- streamType (PlStreamType)
- Determine which stream to use PlStreamType
- function (DelegateStreamWriteFunction)
- A DelegateStreamWriteFunction
Examples
Copy | |
---|---|
static string _testString; static long Swrite(IntPtr handle, string buffer, long buffersize) { string s = buffer.Substring(0, (int)buffersize); _testString = s; return buffersize; } [TestMethod] public void StreamWrite() { // NOTE: the Swrite function is only called if you flush the output or send a newline character const string validationString = "Hello .net world ����"; // The last 4 characters are German umlauts. PlQuery.PlCall("assert( (test_write :- writeln('" + validationString + "'), flush_output) )"); var wf = new DelegateStreamWriteFunction(Swrite); PlEngine.SetStreamFunctionWrite(PlStreamType.Output, wf); PlQuery.PlCall("test_write"); Assert.AreEqual(validationString+"\r\n", _testString); } |
Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60605.0 (1.1.60605.0)