Tibby,
See, I need to use what I read in as a string datatype, then write it back
out. Something's being lost in the conversion. I'll look somemore, but
I'm pretty sure that I cannot use it as a byte array....
Are you certain your file is ASCII Encoding and its not ANSI Encoding with a
specific code page or another encoding?
For information on Encoding, Unicode & character sets see:
http://www.joelonsoftware.com/articles/Unicode.html
&
http://www.yoda.arachsys.com/csharp/unicode.html
If you are making a copy of the file, why bother with Encoding at all??
In fact why bother with the BinaryReader or BinaryWriter??
I would use BinaryReader, BinaryWriter & Encoding objects when my program
needs to PROCESS the data, if I simply need an exact duplicate of the file I
would simply use Stream.Read & Stream.Write, which are inherited by
FileStream.
Something like:
Public Sub TestReadWrite(ByVal FileName As String)
Dim input As New FileStream(fileName, FileMode.Open,
FileAccess.Read)
Dim output As New FileStream("Copy of " & fileName,
FileMode.CreateNew, FileAccess.Write)
Dim count As Integer = 32 * 1024
Dim storage(count - 1) As Byte
count = input.Read(storage, 0, count)
Do Until count = 0
output.Write(storage, 0, count)
count = input.Read(storage, 0, count)
Loop
input.Close()
output.Close()
You can change count to be the size of buffer you want, just be mindful of
Memory Usage versus disk/network IO.
Hope this helps
Jay