I am creating a binary file, for this I am using
namespace BinaryStream
{
class Program
{
static void Main(string[] args)
{
string filename = @"c:\happybirthday.txt";
using (BinaryWriter binWriter =
new BinaryWriter(File.Open(filename, FileMode.Create)))
{
string name = "Sachin";
string wishes = "happy birthday";
binWriter.Write(name.ToCharArray());
binWriter.Write(wishes.ToCharArray());
}
}
}
}
if binWriter.Writer(name) is used the file contains some special characters. But if i convert the string to chararray and write to file , the file contains the normal text(without any special characters).
What is the reason behind this?