简体   繁体   中英

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

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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