C#读取、保存二进制数据文件

保存二进制数据文件

            FileStream fs = new FileStream(sFileName, FileMode.OpenOrCreate);
            BinaryWriter binWriter = new BinaryWriter(fs);

            binWriter.Write(labelContent, 0, labelContent.Length);

            binWriter.Close();
            fs.Close();


读取二进制数据文件

            byte[] bBuffer;

            FileStream fs = new FileStream(sFileName, FileMode.Open);
            BinaryReader binReader = new BinaryReader(fs);

            bBuffer = new byte[fs.Length];
            binReader.Read(bBuffer, 0, (int)fs.Length);

            binReader.Close();
            fs.Close();


已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页