StreamWriter adds an extra carriage return to the end of the file

JumpyNET

Well-known member
Joined
Apr 4, 2005
Messages
151
I use SreamWriter and WriteLine to write to a text-file. But StreamWriter adds an extra carriage return to the end of the file. I tried Write instead of WriteLine but it didnt help.

:confused: How can I get rid of the extra carriage return in the end of the file?

:cool: Im using VB.NET 2003
 
I think I have located the problem. :D It seems like it depends on the file Im writing to. For example if I have an existing file with an extra carriage return in the end, like this:

"Aaaaa
Bbbbb
Ccccc
"

...then I try to write over it a text like this(no carriage return in the end):

"Aaaaa
Bbbbb
Ccccc"

...and like magic it doesnt replace the old text file. :eek: Seems really odd to me!!
 
Back
Top