Najna Abdulla

Najna Abdulla

  • NA
  • 105
  • 37k

file stream

Sep 3 2014 12:58 AM
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 

Answers (1)