Home > Products > CSHTMLDiff Control > Documentation > User Guide

DoDiffStreams
Previous  Top  Next


 
Performs a diff operation between 2 input streams (given as strings), writing the results to a stream.  
 
Syntax  
 
   Function DoDiffStreams(stream1 As String, stream2 As String) As String  
 
Return Value  
 
String containing the output of the Diff operation.  
 
Parameters  
 
   stream1  
Base Input - acts as a base for comparison.  
 
   stream2  
Revised Input - the revised version of the given base stream.  
 
Remarks  
 
Performs a Diff operation between 2 given streams. Both the input streams and the output stream are declared as strings and may contain text control characters - as if the streams were textually read from a file.  
 
Note: In server sided applications it is advised to call the SetTempDir method after creating the control object. This method will create an alternative temp directory for the control, thus avoiding security access problems with the default temp directory.  
     
Example  
 
The following snippet simulates a call to DoDiffStreams:  
 
   Private Sub DiffStreams_Click()  
      Const ForReading = 1, ForWriting = 2, For Appending = 8   
      Dim ForAppending, f  
      Dim strBase As String  
      Dim strRev As String  
      Dim strResult As String  
 
      ' read from input files.  
      Set fso = CreateObject("Scripting.FileSystemObject")   
      Set f = fso.OpenTextFile("C:\LastWeek\Report.html", ForReading)   
      strBase = f.ReadAll   
      f.Close  
      Set f = fso.OpenTextFile("C:\ThisWeek\Report.html", ForReading)   
      strRev = f.ReadAll   
      f.Close  
        
      ' perform a diff and write the output to a file.  
      diffCtrl1.DoDiffStreams strBase, strRev  
        
      Set f = fso.OpenTextFile("C:\Reports\Output.html", ForWriting, True)   
      f.Write strResult   
      f.Close  
   End Sub  
 
See Also  
 
   DoDiff, DiffFiles, Diff Specification