G
Guest
Hi guys,
I'm wondering if you can help me.
For some reason when I use a StreamWriter to write a string to a file there
are weird characters appearing at the start of the file.
The only reason I can notice these characters is because I'm trying to read
the file in Java, and the first few characters aren't meant to be there.
My code (however trivial) looks like this:
Dim fileWriter As StreamWriter
fileWriter =
My.Computer.FileSystem.OpenTextFileWriter(SaveFileDialog.FileName, False)
fileWriter.Write(strContents)
fileWriter.Close()
Where strContents is a String I have already populated.
If I use the following code:
Dim fso As Object, text As Object
fso = CreateObject("scripting.filesystemobject")
text = fso.CreateTextFile(SaveFileDialog.FileName & "1")
text.WriteLine(strContents)
The characters don't appear. So, how am I misusing my StreamWriter? How can
I get it to stop writing those characters?
Thanks in advance,
Joe
I'm wondering if you can help me.
For some reason when I use a StreamWriter to write a string to a file there
are weird characters appearing at the start of the file.
The only reason I can notice these characters is because I'm trying to read
the file in Java, and the first few characters aren't meant to be there.
My code (however trivial) looks like this:
Dim fileWriter As StreamWriter
fileWriter =
My.Computer.FileSystem.OpenTextFileWriter(SaveFileDialog.FileName, False)
fileWriter.Write(strContents)
fileWriter.Close()
Where strContents is a String I have already populated.
If I use the following code:
Dim fso As Object, text As Object
fso = CreateObject("scripting.filesystemobject")
text = fso.CreateTextFile(SaveFileDialog.FileName & "1")
text.WriteLine(strContents)
The characters don't appear. So, how am I misusing my StreamWriter? How can
I get it to stop writing those characters?
Thanks in advance,
Joe