Dinny,
Review the help for BinaryWriter.Write(String)!
Seeing as BinaryWriter is writing a Binary File, it encodes the length of
the string before it writes the encoded characters of the string. It does
this so as to allow reading back the same number of characters in
BinaryReader.ReadString.
For information on the encoded length see the following:
BinaryWriter.Write(String):
http://msdn.microsoft.com/library/de...iteTopic13.asp
Corresponding BinaryReader.ReadString:
http://msdn.microsoft.com/library/de...tringTopic.asp
Hope this helps
Jay
"dinny" <nospam> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am getting an extra character at te beginning of the file,
can someone please check if there is an error in my code?
Dim fs As FileStream
fs = New FileStream(Form1.REGFILE, FileMode.CreateNew, FileAccess.Write)
Dim gw As New BinaryWriter(fs)
gw.Write(s)
gw.Flush()
gw.Close()
fs.Close()