首页 新闻 赞助 找找看

FileStream与BinaryWriter使用问题

0
悬赏园豆:50 [已解决问题] 解决于 2015-09-26 22:52

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”类型的异常

生成文件没有任何数据

evazore的主页 evazore | 初学一级 | 园豆:157
提问于:2015-09-26 16:11
< >
分享
最佳答案
0

代码没问题,文件要用hex查看

收获园豆:50
jello chen | 大侠五级 |园豆:7306 | 2015-09-26 19:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册