using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("save.dat", FileMode.Create);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(1);
bw.Close();
fs.Close();
}
}
}
逐步运行时显示在bw.Write(1);
ReadTimeout = “(bw.BaseStream).ReadTimeout”引发了“System.InvalidOperationException”类型的异常
生成文件没有任何数据
代码没问题,文件要用hex查看