0

何か間違ったことをしているような気がしますが、何が原因かわかりません。

これが私のコードです:

        long offset = 0x009694E3;
        long length = 0x02;
        byte[] bytes = new byte[length];

        // Create the memory-mapped file.
        using (var mmf =
            MemoryMappedFile.CreateFromFile(strFileName, FileMode.Open, "ISO"))
        {
            // Create a random access view, from the 256th megabyte (the offset)
            // to the 768th megabyte (the offset plus length).
            using (var accessor = mmf.CreateViewAccessor(offset, length))
            {
                // Make changes to the view.
                for (long i = 0; i < length; i++)
                {
                    bytes[i] = accessor.ReadByte(i);
                    dialogEdit.Text = bytes[i].ToString();
                }
            }
        }

ファイルをロードすると、上記のオフセットのテキストは 0x22 0x44 (ASCII では "D) ですが、テキスト ボックスへの出力は "68" です...

バイトの仕組みを誤解していると思いますが、完全にはわかりません...

どんな助けでも大歓迎です!

4

1 に答える 1

1

テキスト ボックスで、2 番目のループで値 34 (0x22) を値 68 (0x44) で上書きします。

プログラムは、プログラムされているとおりに機能します。メモリ マップト ファイルのラッキー エスケープ。

于 2013-01-15T01:21:13.703 に答える