FileStream fs new FileStream test txt FileMode Create FileAccess Write

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
FileStream fs = new FileStream("test.txt", FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
BinaryWriter bw = new BinaryWriter(fs, Encoding.Default);
sw.AutoFlush = true;
sw.Write("fuck");
bw.Write(new byte[] { 0xA1,0x20,0x30,0x40,0x50,0x60 });
sw.Write("fuck Again");
bw.Write(new byte[] { 0x60, 0x50, 0x40, 0x30, 0x20, 0xA1 });
if (fs != null)
{
sw.Close();
bw.Close();
}