Static Void Main()
{
Application.Run(New Form1());
}
// 定义私有变量
Public Stream S;
// 读二进制文件
Public Binaryreader R;
// 写二进制文件
Public Binarywriter W;
// 显示二进制文件内容
Private Void Button1_click(Object Sender, System.Eventargs E)
{
S = File.Openread("Test.Bin");
R = New Binaryreader(S);
Richtextbox1.Text += "数字 56:";
Richtextbox1.Text += R.Readint32().Tostring() + "/N";
Richtextbox1.Text += "时间 1999-11-21 08:50:02 :";
Richtextbox1.Text += R.ReadString()+ "/N";
R.Close();
}
}
// 写二进制文件
S = File.Create("Test.Bin");
W = New Binarywriter(S);
String Str = "这是一个时间 1999-11-21 08:50:02 /N";
W.Write(Str);
Int C = 56;
W.Write(C);
W.Flush();
W.Close();
}