简体   繁体   English

二进制数据 Vb6 到 C#

[英]Binary Data Vb6 to C#

I've a problem!我有问题!

I've a binary data that I know that is been created using Vb6, I want read all informations using C#.我有一个二进制数据,我知道它是使用 Vb6 创建的,我想使用 C# 读取所有信息。

How Can I do this?我怎样才能做到这一点?

I don't data structure of the file!!!我没有文件的数据结构!!!

Thanks for your attention感谢您的关注

If you know the structure of the binary stream you can use the BinaryReader class:如果您知道二进制 stream 的结构,您可以使用BinaryReader class:

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
    ...
}

If you don't know the structure you are trying to read, you will need some hard guessing.如果您不知道要阅读的结构,则需要进行一些艰难的猜测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM