Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
Import java#io#PrintStream Public psError As PrintStream Public psOut As PrintStream '... '... '... Public Sub main(ByJava args() As String) '... '... Dim opStreamErr As clsOutputStream Dim opStreamOut As clsOutputStream '... '... frmTest.SetDefaultClose() frmTest.Show() opStreamErr = New clsOutputStream( frmTest.txtError ) psError = New PrintStream( opStreamErr ) opStreamOut = New clsOutputStream( frmTest.txtOutput ) psOut = New PrintStream( opStreamOut ) System.setErr( psError ) System.setOut( psOut ) System.out.println( "Testing, what should be standard output" ) System.err.println( "Testing what should be standard error" ) End Sub |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Import java#io#OutputStream Import VB#TextBox Dim txtJBTextArea As VB#TextBox Public Sub clsOutputStream( txtJB As VB#TextBox ) txtJBTextArea = txtJB End Sub Public Sub write( nOutputCharacter As Integer ) Me.writeOverridable( nOutputCharacter ) End Sub Public Sub writeOverridable( nOutputCharacter As Integer ) Dim cOutputCharacter As String cOutputCharacter = Chr( nOutputCharacter ) txtJBTextArea.AppendText( cOutputCharacter ) End Sub |
Quoted
java/io/OutputStream
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 |
Public Sub write( nOutputCharacter As Integer ) 'Me.writeOverridable( nOutputCharacter ) Dim cOutputCharacter As String cOutputCharacter = Chr( nOutputCharacter ) txtJBTextArea.AppendText( cOutputCharacter ) End Sub |
Hey there,
nice sample on how to redirect an output stream.
THANKS...
BY using
Quoted
java/io/OutputStream
as superclass for clsOutputStream you are allready overriding every generic method and property that you are addressing!
So...
Jabaco Source
1 2 3 4 5 6 7 8 9 10 Public Sub write( nOutputCharacter As Integer ) 'Me.writeOverridable( nOutputCharacter ) Dim cOutputCharacter As String cOutputCharacter = Chr( nOutputCharacter ) txtJBTextArea.AppendText( cOutputCharacter ) End Sub
will do the job!
Dani
Is there a way to tag these posts, for example with keywords like 'stdout' and 'stderr'?