using (FileStream fs = File.Create(path))
{
AddText(fs, "This is some text");
AddText(fs, "This is some more text,");
AddText(fs, "\r\n and this is on a new line");
for (int i = 1; i < 120; i++)
{
AddText(fs, Convert.ToChar(i).ToString());
}
}
private static void AddText(FileStream fs, string value)
{
byte[] info = new UTF8Encoding(true).GetBytes(value);
fs.Write(info, 0, info.Length);
}
Anyone plz understand me the writing of data to byte array
Guest UserPosted Sep 3, 2014, 4:31 AM
ascii
A=>65
B=>66
so if there is AB written in value then it'll be 6566 and not it'll convert this 65 into byte and 66 into bytes which will is binary language.
hope this helps.
Please click checkbox "This is correct answer" if you find it helpful!