Write data to file through FileStream via an array
using System;
using System.IO;
public class MainClass
{
static void Main(string[] args)
{
FileStream MyFileStream1 = new FileStream(@"c:\Testing.txt", FileMode.Create);
int NumberOfBytesToWrite = 256;
byte[] MyWriteByteArray = new Byte[NumberOfBytesToWrite];
for (int i = 0; i < 256; i++)
{
MyWriteByteArray[i] = (byte)i;
i++;
}
MyFileStream1.Write(MyWriteByteArray, 0, NumberOfBytesToWrite);
MyFileStream1.Close();
}
}