兄弟们帮我看看这段代码哪里有问题啊!!!!!!
using System;
using System.IO;
public class FileApp
{
public static void Main()
{
FileStream fsMyfile = new FileStream("myfile.txt" , FileMode.Create, FileAccess.ReadWrite);
StreamWriter swMyfile = new StreamWriter(fsMyfile);
swMyfile.WriteLine("Hello, World");
swMyfile.WriteLine("abcdefghijklmnopqrstuvwxyz");
swMyfile.WriteLine("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
swMyfile.WriteLine("0123456789");
swMyfile.Flush();
BinaryReader brMyfile= new BinaryReader (fsMyfile);
brMyfile.BaseStream.Seek(0, SeekOrigin.Begin);
Console.WriteLine("****************以二进制方式读文件*********************");
Byte b1;
while(brMyfile.PeekChar()>-1)
{
b1=brMyfile.ReadByte();
if(b1 != 13 && b1 != 10)
{
Console.Write("{0}",b1.ToString());
Console.Write(".");
}
else
{
Console.WriteLine();
}
}
Console.WriteLine("\n");
brMyfile.Close();
swMyfile.Close();
fsMyfile.Close();
}
}
出错信息: 编译成.exe后进行就出现"fileapp.exe遇到问题需要关闭,我们对此引起的不便.........