Using the BinaryWriter???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the BinaryWriter to write binary information to the end of a file. When i write the info the string always starts with â–¡, so my string turns out to be "â–¡MyString", what am i missing here

--- Here is the code that i am using to make this happen, like i said, it works but when i use the binaryReader to read the file i get â–¡ in front of the string

Dim binWriter As New BinaryWriter(sfile
binWriter.BaseStream.Seek(-129, SeekOrigin.End

binWriter.Write("MyString"

binWriter.Flush(
binWriter.Close(
sfile.Close(

Thanks Eric
 
When i write the info the string always starts with ?, so my string turns out to be "?MyString", what am i missing here?

BinaryWriter writes a length-prefixed string to the stream. The ? is
probably the result of interpreting the length integer as a character.

If you don't want the length written, use a StreamWriter instead, or
BinaryWriter.Write(char[]).



Mattias
 
Back
Top