【问题标题】:Binary Data Vb6 to C#二进制数据 Vb6 到 C#
【发布时间】:2009-03-08 17:17:58
【问题描述】:

我有问题!

我知道使用 Vb6 创建的二进制数据,我想使用 C# 读取所有信息。

我该怎么做?

我没有文件的数据结构!!!

感谢您的关注

【问题讨论】:

    标签: c# vb6 file-io binary binary-data


    【解决方案1】:

    如果你知道二进制流的结构,你可以使用BinaryReader 类:

    using (Stream inputStream = new FileStream("test.bin", FileMode.Open, FileAccess.Read, FileShare.Read))
    using (BinaryReader reader = new BinaryReader())
    {
        int value1 = reader.ReadInt32(); // read 32 bit integer
        float value2 = reader.ReadSingle(); // read a single-precision 32-bit number
        char[] value3 = reader.ReadChars(10); // read 10, 16-bit unicode characters
        ...
    }
    

    如果您不知道要阅读的结构,则需要进行一些艰难的猜测。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-28
      • 1970-01-01
      • 1970-01-01
      • 2017-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-13
      相关资源
      最近更新 更多