Hi,
I am trying to modify this function that load an external file.
Instead of it writing bit by bit to the 'Stream' IOStream, I would like to write the data to a temporary MemoryStream, and then write it to 'Stream' all at once. I think this should be right before the 'Stream.Close()' line.
Can you help me ?
Here is my current code:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Thanks
	
		
			
		
		
	
				
			I am trying to modify this function that load an external file.
Instead of it writing bit by bit to the 'Stream' IOStream, I would like to write the data to a temporary MemoryStream, and then write it to 'Stream' all at once. I think this should be right before the 'Stream.Close()' line.
Can you help me ?
Here is my current code:
			
				VB.NET:
			
		
		
		        Dim FromStream As System.IO.Stream = Nothing
        FromStream = GetFileStream(Path)
        If Not FromStream Is Nothing Then
            Const Size As Integer = 256 * 1024
            Dim buffer(Size) As Byte
            Dim ReadBytes As Integer
            While True
                ReadBytes = FromStream.Read(buffer, 0, Size)
                If ReadBytes = 0 Then Exit While
                Try
                    Stream.Write(buffer, 0, ReadBytes)
                Catch e As System.IO.IOException
                    ' Loading is interrupted
                    Exit While
                End Try
            End While
            Stream.Close()
            Handled = True
        End If
	Thanks