![Copy image Copy image](icons/copycode.gif)
![CopyHover image CopyHover image](copycodeHighlight.gif)
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.
![](collapse_all.gif)
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
![](collapse_all.gif)
- streamType (PlStreamType)
- Determine which stream to use PlStreamType
- function (DelegateStreamWriteFunction)
- A DelegateStreamWriteFunction
![](collapse_all.gif)
![]() |
|
---|---|
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)