Possible Duplicate:
Why does BinaryWriter prepend gibberish to the start of a stream? How do you avoid it?
public static void saveFile(string path, string data)
{
using (Stream fileStream = File.Open(path, FileMode.Append, FileAccess.Write, FileShare.None))
{
using (BinaryWriter bw = new BinaryWriter(fileStream))
{
bw.Write(data);
}
}
}
However, everytime the method is called it adds the following 2 characters before writing:
. I'm saving it to a .txt if it makes any difference. Also, the string displays fine on the trace output. How do I fix this?