1
Answer

file stream

Najna Abdulla

Najna Abdulla

10y
837
1
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)