簡體   English   中英

二進制數據 Vb6 到 C#

[英]Binary Data Vb6 to C#

我有問題!

我有一個二進制數據,我知道它是使用 Vb6 創建的,我想使用 C# 讀取所有信息。

我怎樣才能做到這一點?

我沒有文件的數據結構!!!

感謝您的關注

如果您知道二進制 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
    ...
}

如果您不知道要閱讀的結構,則需要進行一些艱難的猜測。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM