第1个回答 2011-12-06
读取txt:
private void Open()
{
openFileDialog1.Filter = "(*.txt)|*.txt";
openFileDialog1.FileName = "20110901.txt";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
recordPathMobile = openFileDialog1.FileName;
FileStream stream = new FileStream(recordPathMobile, FileMode.OpenOrCreate, FileAccess.Read);
....................
}
保存:
private void Store()
{
if (recordPathMobile == null)
{
Common.MsgInfo("请先选择需要导入的文本……");
return;
}
byte[] byDataBuf = null;
FileStream stream = new FileStream(recordPathMobile, FileMode.OpenOrCreate, FileAccess.Read);
byDataBuf = File.ReadAllBytes(recordPathMobile);
}