All you have to do is iterate over the byte array and replace the occurances
of 0 with 32. No need to convert it to a string.
But, you might want to keep track of exactly how many bytes you read from
the file and only iterate over that many in the array.
For i As Integer = 0 to buf.Length - 1
If buf(i) = 0 Then
buf(i) = 32
End If
Next
--
<i><b>RageInTheMachine9532</b></i><font size="-2">
"<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming
Gnome</b></font>
"JT" wrote:
dim br as BinaryReader(stream)
dim buf(5000) as byte
br.Read(buf,0,5000)
closeit..
I have read a binary file into a buffer. This buffer contains many different
chars as well as a few null chars. I want to replace the (NULLS)chr(0)'s
with (SPACES)chr(32)'s. How can I do this. REPLACE does not seem to be an
option, If I converted it to a string I was afraid the string would stop at
the first NULL truncating the remaining chars. Any ideas on how to do
this...
Thanks
JT