views:

225

answers:

1

Hi guys,

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

+3  A: 

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.

Darin Dimitrov